lib1537.c : check ptr against NULL before dereferencing it #6707
Comments
What is wrong with printing a |
@gvanem AFAIK not all implementations of As far as I am aware, it is undefined behavior (not even just implementation-defined). See e.g. https://trust-in-soft.com/blog/2019/07/09/printing-a-null-pointer-with-s-is-undefined-behavior/ EDIT: From https://www.gnu.org/software/libc/manual/html_node/Other-Output-Conversions.html
That was my rationale. Some implementations of printf would crash during test instead of giving a nice error-message |
But
|
Then it seem the issue is non-problematic for you. Thanks for quick response :) |
try it |
@jay what do you mean? Are you suggesting we build without using our own implementation at times? |
@bagder is right that many If you dont care much about UB in test code, that is understandable as well. |
If we use our printf() implementation where we deal with this perfectly fine (to my knowledge). How can that be UB? |
@bagder do you use your own My tool thinks all calls to |
I forgot about that, withdrawn! |
I did this
Hi guys,
I am testing a homemade static analysis tool on a few code bases.
I checked out your master-branch and ran my tool and fell over this curiosity, which I think is indicative of a bug.
From tests/libtest/lib1537.c : 49-51
The text was updated successfully, but these errors were encountered: