[compiler-rt] [llvm] [TypeProf][InstrPGO] Introduce raw and instr profile format change for type profiling. (PR #81691)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 15:46:27 PST 2024


================
@@ -1260,6 +1283,19 @@ Error IndexedInstrProfReader::readHeader() {
                                         "corrupted binary ids");
   }
 
+  if (GET_VERSION(Header->formatVersion()) >= 12) {
+    uint64_t VTableNamesOffset =
+        endian::byte_swap<uint64_t, llvm::endianness::little>(
+            Header->VTableNamesOffset);
+    const unsigned char *Ptr = Start + VTableNamesOffset;
+
+    CompressedVTableNamesLen =
+        support::endian::readNext<uint64_t, llvm::endianness::little,
+                                  unaligned>(Ptr);
+
+    VTableNamePtr = (const char *)Ptr;
----------------
modiking wrote:

Should there be a check that this is a valid pointer before dereferencing it against buffer end like above?

https://github.com/llvm/llvm-project/pull/81691


More information about the llvm-commits mailing list