-
Notifications
You must be signed in to change notification settings - Fork 497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
printf("%s", NULL) - crash #63
Comments
I just came here to add just that!
|
This should be an optional behaviour as in many embedded situations address zero is a perfectly valid one. |
@dev-zzo : What about |
…ones. * "splits" behavior of pointers and hash-marked base-16 values w.r.t the `0x` prefix (although you won't see the difference unless you un-special-case the handling of 0-valued pointer). * Adds a CMake option to choose between zero pointers being interprted as null and invalid (and formatted as `(nil)`), and them being handled just like any other valid pointer, including dereferencing for `%s`. * When 0-valued pointers are assumed to be invalid, passing a null pointer for an `%s` will result in `(null)`. * Added some relevant assertions involving null/0 pointers as `%s` arguments, for when we _are_ giving 0 pointers special treatment (the default case).
So, this issue is now fixed on my fork. @dev-zzo , @noomio , @mpaland Please have a look and voice your opinion about the behavior with null/0 pointers. Also, @mpaland : Can you explain the code's "partiality" to the use of _out_rev? That is, what's the benefit of printing characters backwards like that? I used it too in the changes I made for this issue, but I was just following the pattern. |
…epresentation is no all-0-bits. * "splits" behavior of pointers and hash-marked base-16 values w.r.t the `0x` prefix (although you won't see the difference unless you un-special-case the handling of 0-valued pointer). * Passing a null pointer for an `%s` now results in `(null)`. * Added some relevant test suite assertions involving null/0 pointers as `%s` arguments.
Hi!
Some placeholder should be used for NULL %s argument to prevent printf from crash:
The text was updated successfully, but these errors were encountered: