Skip to content

build: fix possible -Wformat-overflow in lib557 with test bundle builds#15012

Closed
vszakats wants to merge 5 commits intocurl:masterfrom
vszakats:fix-no-format
Closed

build: fix possible -Wformat-overflow in lib557 with test bundle builds#15012
vszakats wants to merge 5 commits intocurl:masterfrom
vszakats:fix-no-format

Conversation

@vszakats
Copy link
Copy Markdown
Member

@vszakats vszakats commented Sep 22, 2024

Fixes:
```
lib557.c: In function ‘test_float_formatting’:
lib557.c:1408:37: error: ‘%*f’ directive output of 2147483648 bytes exceeds ‘INT_MAX’ [-Werror=format-overflow=]
 1408 |   curl_msnprintf(buf, sizeof(buf), "%*f", INT_MIN, 9.1);
      |                                     ^~~
lib557.c:1408:3: note: ‘curl_msnprintf’ output 2147483649 bytes
 1408 |   curl_msnprintf(buf, sizeof(buf), "%*f", INT_MIN, 9.1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Ref: https://app.circleci.com/pipelines/github/curl/curl/10226/workflows/87642ee9-cda6-4916-8206-c82aac5f595e/jobs/107669?invite=true#step-106-40996_46
It's not enabled by a picky warning, so there is no use of disabling
it there. These options only get used with picky warnings enabled.
@vszakats vszakats closed this in 4619b41 Sep 23, 2024
@vszakats vszakats deleted the fix-no-format branch September 23, 2024 09:54
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
…ilds

- lib557: suppress `-Wformat-overflow` warning in source.
  Fixes:
  ```
  lib557.c: In function ‘test_float_formatting’:
  lib557.c:1408:37: error: ‘%*f’ directive output of 2147483648 bytes exceeds ‘INT_MAX’ [-Werror=format-overflow=]
   1408 |   curl_msnprintf(buf, sizeof(buf), "%*f", INT_MIN, 9.1);
        |                                     ^~~
  lib557.c:1408:3: note: ‘curl_msnprintf’ output 2147483649 bytes
   1408 |   curl_msnprintf(buf, sizeof(buf), "%*f", INT_MIN, 9.1);
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ```
  Ref: https://app.circleci.com/pipelines/github/curl/curl/10226/workflows/87642ee9-cda6-4916-8206-c82aac5f595e/jobs/107669?invite=true#step-106-40996_46

  The root cause of why this option gets enabled remains undiscovered.

  Reported-by: Daniel Stenberg
  Fixes curl#15008
  Follow-up to 71cf0d1 curl#14772

- build: drop `-Wno-format-overflow` from picky warning list.
  These options only get used with picky warnings enabled.
  Follow-up to 145f87b curl#14598

- unit1652: suppress in source (and not rely on picky warnings anymore.)

Closes curl#15012
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.

gcc-9 printf format warnings in lib557.c

1 participant