[PATCH] D47731: Fix for llvm-dis/llvm-bcanalyzer overflows

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 4 12:24:24 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL333942: Fix for llvm-dis/llvm-bcanalyzer overflows (authored by tejohnson, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D47731

Files:
  llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
  llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp


Index: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
===================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
+++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
@@ -429,7 +429,7 @@
     // don't care what code widths are used inside of it.
     ReadVBR(bitc::CodeLenWidth);
     SkipToFourByteBoundary();
-    unsigned NumFourBytes = Read(bitc::BlockSizeWidth);
+    size_t NumFourBytes = Read(bitc::BlockSizeWidth);
 
     // Check that the block wasn't partially defined, and that the offset isn't
     // bogus.
Index: llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
===================================================================
--- llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
+++ llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
@@ -602,7 +602,7 @@
     ++BlockStats.NumRecords;
 
     StringRef Blob;
-    unsigned CurrentRecordPos = Stream.GetCurrentBitNo();
+    uint64_t CurrentRecordPos = Stream.GetCurrentBitNo();
     unsigned Code = Stream.readRecord(Entry.ID, Record, &Blob);
 
     // Increment the # occurrences of this code.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47731.149829.patch
Type: text/x-patch
Size: 1137 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180604/487991bd/attachment.bin>


More information about the llvm-commits mailing list