[PATCH] D64564: Loop pragma parsing. NFC.

Sjoerd Meijer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 30 11:16:32 PDT 2019


SjoerdMeijer marked an inline comment as done.
SjoerdMeijer added inline comments.


================
Comment at: lib/Parse/ParsePragma.cpp:1011
+  Str = llvm::StringSwitch<StringRef>(Str)
+               .Case("loop", "clang loop " + Str.str())
+               .Case("unroll_and_jam", Str)
----------------
Meinersbur wrote:
> [serious] I know I already accepted the patch, but I just noticed something:
> `"clang loop " + Str.str()` will allocate a temporary std::string, `Str` will potentially point to it, then the temporary string will be released. `Str` will then point to released memory and returned by this function, i.e. a use-after-free.
> 
Oopsy, thanks for spotting this! Will fix this!


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

https://reviews.llvm.org/D64564





More information about the cfe-commits mailing list