Skip to content

vtls: fix compiler warnings seen with gcc 7.3.0 and mbedTLS - #16614

Closed
vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:gcc-mbedtls
Closed

vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:gcc-mbedtls

Conversation

@vszakats

@vszakats vszakats commented Mar 7, 2025 •

Copy link
Copy Markdown
Member

Seen with downloaded mingw 7.3.0 when built against MSYS2 mbedTLS 3.6.2:

lib/vtls/cipher_suite.c: In function 'cs_zip_to_str':
lib/vtls/cipher_suite.c:789:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[1] = ((zip[0] << 4) & 0x3F) | zip[1] >> 4;
                ^
lib/vtls/cipher_suite.c:790:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[2] = ((zip[1] << 2) & 0x3F) | zip[2] >> 6;
                ^
lib/vtls/cipher_suite.c:793:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[5] = ((zip[3] << 4) & 0x3F) | zip[4] >> 4;
                ^
lib/vtls/cipher_suite.c:794:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[6] = ((zip[4] << 2) & 0x3F) | zip[5] >> 6;
                ^

Ref: https://github.com/curl/curl/actions/runs/13719756989/job/38372409927?pr=16429#step:10:21

Cherry-picked from #16429

Seen with downloaded mingw 7.3.0 when built against MSYS2 mbedtls 3.6.2:
```
In file included from bld/lib/CMakeFiles/libcurl_object.dir/Unity/unity_4_c.c:88:0:
lib/vtls/cipher_suite.c: In function 'cs_zip_to_str':
lib/vtls/cipher_suite.c:789:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[1] = ((zip[0] << 4) & 0x3F) | zip[1] >> 4;
                ^
lib/vtls/cipher_suite.c:790:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[2] = ((zip[1] << 2) & 0x3F) | zip[2] >> 6;
                ^
lib/vtls/cipher_suite.c:793:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[5] = ((zip[3] << 4) & 0x3F) | zip[4] >> 4;
                ^
lib/vtls/cipher_suite.c:794:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[6] = ((zip[4] << 2) & 0x3F) | zip[5] >> 6;
                ^
```
Ref: https://github.com/curl/curl/actions/runs/13719756989/job/38372409927?pr=16429#step:10:21
@vszakats vszakats changed the title cipher_suite: fix compiler warning seen with gcc 7.3.0 and mbedtls cipher_suite: fix compiler warning seen with gcc 7.3.0 and mbedTLS Mar 7, 2025
@vszakats vszakats changed the title cipher_suite: fix compiler warning seen with gcc 7.3.0 and mbedTLS vtls: fix compiler warning seen with gcc 7.3.0 and mbedTLS Mar 7, 2025
@vszakats vszakats changed the title vtls: fix compiler warning seen with gcc 7.3.0 and mbedTLS vtls: fix compiler warnings seen with gcc 7.3.0 and mbedTLS Mar 7, 2025
@vszakats vszakats mentioned this pull request Mar 7, 2025
5 tasks done
@vszakats vszakats closed this in a7c8d2f Mar 7, 2025
@vszakats
vszakats deleted the gcc-mbedtls branch March 7, 2025 14:43
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Seen with downloaded mingw 7.3.0 when built against MSYS2 mbedTLS 3.6.2:
```
lib/vtls/cipher_suite.c: In function 'cs_zip_to_str':
lib/vtls/cipher_suite.c:789:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[1] = ((zip[0] << 4) & 0x3F) | zip[1] >> 4;
                ^
lib/vtls/cipher_suite.c:790:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[2] = ((zip[1] << 2) & 0x3F) | zip[2] >> 6;
                ^
lib/vtls/cipher_suite.c:793:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[5] = ((zip[3] << 4) & 0x3F) | zip[4] >> 4;
                ^
lib/vtls/cipher_suite.c:794:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[6] = ((zip[4] << 2) & 0x3F) | zip[5] >> 6;
                ^
```
Ref: https://github.com/curl/curl/actions/runs/13719756989/job/38372409927?pr=16429#step:10:21

Cherry-picked from curl#16429
Closes curl#16614
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant