[llvm] r241831 - [llvm-readobj] Re-add sanity checking which was accidentally removed in r241764

David Majnemer david.majnemer at gmail.com
Thu Jul 9 11:14:31 PDT 2015


Author: majnemer
Date: Thu Jul  9 13:14:31 2015
New Revision: 241831

URL: http://llvm.org/viewvc/llvm-project?rev=241831&view=rev
Log:
[llvm-readobj] Re-add sanity checking which was accidentally removed in r241764

Modified:
    llvm/trunk/tools/llvm-readobj/COFFDumper.cpp

Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=241831&r1=241830&r2=241831&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Thu Jul  9 13:14:31 2015
@@ -597,8 +597,15 @@ void COFFDumper::printCodeViewDebugInfo(
       // in the line table.  The filename string is accessed using double
       // indirection to the string table subsection using the index subsection.
       uint32_t OffsetInIndex = DE.getU32(&Offset),
-               SegmentLength = DE.getU32(&Offset);
-      Offset += sizeof(uint32_t); // Skip FullSegmentSize
+               SegmentLength = DE.getU32(&Offset),
+               FullSegmentSize = DE.getU32(&Offset);
+
+      if (FullSegmentSize !=
+          12 + 8 * SegmentLength +
+              (HasColumnInformation ? 4 * SegmentLength : 0)) {
+        error(object_error::parse_failed);
+        return;
+      }
 
       uint32_t FilenameOffset;
       {





More information about the llvm-commits mailing list