[PATCH] D107051: [clang][analyzer] Improve bug report in alpha.security.ReturnPtrRange

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 5 07:26:01 PDT 2021


balazske added a comment.

If the original memory object is not known the static size is not known too. Every pointer with unknown source can point into a bigger data structure.



================
Comment at: clang/test/Analysis/return-ptr-range.cpp:11
+int *test_global_ptr() {
+  do { // expected-note{{Loop condition is false.  Exiting loop}}
     int x = conjure_index();
----------------
steakhal wrote:
> I would rather use a simple block `{...}` for opening a scope, but I don't know why you don't declare `ptr` in the original scope in the first place.
> People usually use `do {} while(0)` constructs if they want to use `break` somewhere ~~ like a `goto` OR they implement a macro. You are doing none of these.
I do not know why these loops are here but did not change the original code. Should we change it to simple block?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107051



More information about the cfe-commits mailing list