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

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 11 01:59:16 PDT 2021


steakhal accepted this revision.
steakhal added inline comments.


================
Comment at: clang/test/Analysis/return-ptr-range.cpp:17
       return arr; // no-warning
-  } while (0);
-  return ptr; // expected-warning{{Returned pointer value points outside the original object (potential buffer overflow)}}
+  }
+  return ptr; // expected-warning{{Returned pointer value points outside the original object (potential buffer overflow) [alpha.security.ReturnPtrRange]}}
----------------
balazske wrote:
> steakhal wrote:
> > I don't think we need this extra scope. Same for the others.
> The original test was used to make the `x` "dead" at return after the loop (at least without the fix), see D12726. In the case of loop the `x` is garbage-collected at end of the loop, if a block is used only at the end of the function (?) but not at end of the block. So I want to put back the loop to preserve the original code.
Thank you for letting me know.


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