r333069 - Fix unaligned memory access when reading INPUT_FILE_OFFSETS data

Raphael Isemann via cfe-commits cfe-commits at lists.llvm.org
Wed May 23 02:02:40 PDT 2018


Author: teemperor
Date: Wed May 23 02:02:40 2018
New Revision: 333069

URL: http://llvm.org/viewvc/llvm-project?rev=333069&view=rev
Log:
Fix unaligned memory access when reading INPUT_FILE_OFFSETS data

Summary: The blob data is unaligned, so we also should read it as such. Should fix the random failures with the sanitizer builds.

Reviewers: rsmith, v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D47247

Modified:
    cfe/trunk/lib/Serialization/ASTReader.cpp

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=333069&r1=333068&r2=333069&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed May 23 02:02:40 2018
@@ -4811,7 +4811,8 @@ bool ASTReader::readASTFileControlBlock(
 
       unsigned NumInputFiles = Record[0];
       unsigned NumUserFiles = Record[1];
-      const uint64_t *InputFileOffs = (const uint64_t *)Blob.data();
+      const llvm::support::unaligned_uint64_t *InputFileOffs =
+          (const llvm::support::unaligned_uint64_t *)Blob.data();
       for (unsigned I = 0; I != NumInputFiles; ++I) {
         // Go find this input file.
         bool isSystemFile = I >= NumUserFiles;




More information about the cfe-commits mailing list