[all-commits] [llvm/llvm-project] 99ad95: [PGO] Don't call calloc(0, sizeof(ValueProfNode *))

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Jul 22 18:49:44 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 99ad956fdaee5398fdcf46fa49cb433cf52dc461
      https://github.com/llvm/llvm-project/commit/99ad956fdaee5398fdcf46fa49cb433cf52dc461
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-07-22 (Wed, 22 Jul 2020)

  Changed paths:
    M compiler-rt/lib/profile/InstrProfilingValue.c

  Log Message:
  -----------
  [PGO] Don't call calloc(0, sizeof(ValueProfNode *))

A malloc implementation may return a pointer to some allocated space.  It is
undefined for libclang_rt.profile- to access the object - which actually happens
in instrumentTargetValueImpl, where ValueCounters[CounterIndex] may access a
ValueProfNode (from another allocated object) and crashes when the code accesses
the object referenced by CurVNode->Next.




More information about the All-commits mailing list