[PATCH] D97239: [profile] Fix buffer overrun when parsing %c in filename string

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 14:40:25 PST 2021


vsk added inline comments.


================
Comment at: compiler-rt/lib/profile/InstrProfilingFile.c:773
         __llvm_profile_set_page_size(getpagesize());
         __llvm_profile_enable_continuous_mode();
       } else {
----------------
kastiglione wrote:
> vsk wrote:
> > MaskRay wrote:
> > > Adding `getChar` seems excessive. Does simply dropping `I++` here fix the bug?
> > Yes. `getChar` adds a little complexity, but lets us write a test that reliably fails pre-patch. I think that's worth it.
> So adding `getChar`, but not removing the `I++` causes test failure. And then leaving `getChar` also protects against future changes to the loop body?
Yes, that's right. The checkBounds helper should serve the same role.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97239



More information about the llvm-commits mailing list