[PATCH] D108142: [SamplePGO] Fixing a memory issue when creating profiles on-demand

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 16 11:55:30 PDT 2021


hoy added a comment.

In D108142#2947508 <https://reviews.llvm.org/D108142#2947508>, @wenlei wrote:

> Thanks for the fix. I guess since we didn't really use the key of the map, it was just a hidden bug not causing trouble in the past (no ICE)?

We have a test for this currently, but since it is small it doesn't capture the use-after-free case.



================
Comment at: llvm/include/llvm/ProfileData/SampleProfReader.h:411
+    auto It = Profiles.find(CanonName);
+    if (It == Profiles.end()) {
+      if (!FGUID.empty())
----------------
wenlei wrote:
> Can we assert this only happens for MD5? 
> 
> Additionally, NameBuffer -> MD5NameBuffer to make that explicit?
Sounds good.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108142



More information about the llvm-commits mailing list