[PATCH] D64564: Loop pragma parsing. NFC.

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 30 08:44:10 PDT 2019


Meinersbur requested changes to this revision.
Meinersbur added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/Parse/ParsePragma.cpp:1011
+  Str = llvm::StringSwitch<StringRef>(Str)
+               .Case("loop", "clang loop " + Str.str())
+               .Case("unroll_and_jam", Str)
----------------
[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.



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

https://reviews.llvm.org/D64564





More information about the cfe-commits mailing list