[PATCH] D154838: [analyzer] Add check for null pointer passed to %p of printf family

Georgiy Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 10 01:06:54 PDT 2023


CuriousGeorgiy added a comment.

@NoQ thank you for the feedback too!

> So if you want to support non-standard functions, and you know that they have the same portability issues, totally go for it!

AFAIC, the functions I listed are very exotic, so I would rather skip them.

> Probably a separate check would be better. The consequences of `malloc(0)` are likely to be much more dire than consequences of `printf("%p", 0)`, so people may want to enable/disable them separately.

I moved it to a separate checker, but I'm not sure about the naming, any suggestions? BTW, I guess it should be `printf("%p", NULL)`, since as @MitalAshok pointed out, we should only consider pointer type values.

> The run-lines are mostly self-explanatory. Just run it through the grep command in the other run-line. It filters out all the non-transferable stuff.

Sorry, my bad, I didn't notice this, updated the plist correctly now.

> This really doesn't accomplish anything, `assume()` already does a lot more than that. Just rely on `assume()`, or make it a completely path-insensitive check if you want to stick to literal constants.

Dropped this check, thanks for point this out!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154838/new/

https://reviews.llvm.org/D154838



More information about the cfe-commits mailing list