Repository navigation
Conversation
1 task done
PRINTFZ rulePRINTFZ rule, enable for examples
jay
approved these changes
Oct 13, 2026
jay
left a comment
Member
There was a problem hiding this comment.
I suggest a comment in checksrc to explain what PRINTFZ is for. This could also be expanded on in the docs to explain the reason %z is banned from certain directories, because I don't think it's going to be immediately obvious to anyone except us.
Replace a stray entry with the new option.
vszakats
force-pushed
the
checksrc-printfz
branch
from
October 13, 2026 21:24
cff632c to
0e0522b
Compare
vszakats
added a commit
that referenced
this pull request
Oct 14, 2026
The test server code uses plain CRT printf functions, and uses the. `%zd`, `%zu` masks in `logmsg()` calls. It compiles cleanly with all supported compilers. But, the CRT of VS2013 (and earlier) do not actually support these masks, and print `zd`/`zu` as-is instead. This by itself would likely not break tests, but it also leaves the `[s]size_t` varargs unconsumed, which crashes the server on the first client request. In practice this means that most tests relying on the test server, failed. With `sws`, the symptom was a `Read zd bytes` message in the log. E.g.: https://ci.appveyor.com/project/curlorg/curl/builds/54869181 Fix by using `%ld`/`%lu`, with matching casts. Test run: https://ci.appveyor.com/project/curlorg/curl/builds/54882859 (remaining failures are unrelated.) This has been a potential issue since 2008. Also: - dnsd: keep `n` as signed when printing it in `doh_conn_recv()`. - tests/server: enable `PRINTFZ` checksrc rule for this directory, to avoid reintroducing a silent breakage by using these masks. Bug: #23306 (comment) Bug: #23306 (comment) Ref: 7f47b6e #23383 Cherry-picked from #23306 Closes #23378
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To catch the use of
%zd/%zumasks in code that uses the CRT printfs.This is currently in docs/example, and upcoming in tests/server in a
separate patch. These masks pass compilation in all supported compiler,
but, with the CRT of VS2013 and earlier, they result in a runtime crash.
There was existing use of these masks in examples.
Also:
Follow-up to c445b74 checksrc: introduce 'banfunc' to ban specific functions #15835
1185with%TESTNUMBER.Cherry-picked from #23378