[PATCH] D148217: [BOLT][NFC] Fix UB due to unaligned load in DebugStrOffsetsWriter

Job Noorman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 07:39:44 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8bbfac7be1b1: [BOLT][NFC] Fix UB due to unaligned load in DebugStrOffsetsWriter (authored by jobnoorman).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148217

Files:
  bolt/lib/Core/DebugData.cpp


Index: bolt/lib/Core/DebugData.cpp
===================================================================
--- bolt/lib/Core/DebugData.cpp
+++ bolt/lib/Core/DebugData.cpp
@@ -1166,7 +1166,7 @@
          "Dwarf String Offsets Byte Size is not supported.");
   uint32_t Index = 0;
   for (uint64_t Offset = 0; Offset < Contr->Size; Offset += DwarfOffsetByteSize)
-    IndexToAddressMap[Index++] = *reinterpret_cast<const uint32_t *>(
+    IndexToAddressMap[Index++] = support::endian::read32le(
         StrOffsetsSection.Data.data() + Contr->Base + Offset);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148217.513232.patch
Type: text/x-patch
Size: 558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/fa07639c/attachment.bin>


More information about the llvm-commits mailing list