llvm.org GIT mirror llvm / 06b7597
Fix for llvm-dis/llvm-bcanalyzer overflows Summary: These tools failed for a very large bitcode file produced by LTO due to 64-bit values being assigned to 32-bit types. For the BitstreamReader.h fix, the value initially fit into the 32-bit unsigned, but there was an overflow when multiplying by 32 furter below to compute the bit offset. No test case in the patch as this requires a huge bitcode file. Reviewers: pcc, george.karpenkov Subscribers: mehdi_amini, a.sidorin, llvm-commits Differential Revision: https://reviews.llvm.org/D47731 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333942 91177308-0d34-0410-b5e6-96231b3b80d8 Teresa Johnson 2 years ago
2 changed file(s) with 2 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
428428 // don't care what code widths are used inside of it.
429429 ReadVBR(bitc::CodeLenWidth);
430430 SkipToFourByteBoundary();
431 unsigned NumFourBytes = Read(bitc::BlockSizeWidth);
431 size_t NumFourBytes = Read(bitc::BlockSizeWidth);
433433 // Check that the block wasn't partially defined, and that the offset isn't
434434 // bogus.
601601 ++BlockStats.NumRecords;
603603 StringRef Blob;
604 unsigned CurrentRecordPos = Stream.GetCurrentBitNo();
604 uint64_t CurrentRecordPos = Stream.GetCurrentBitNo();
605605 unsigned Code = Stream.readRecord(Entry.ID, Record, &Blob);
607607 // Increment the # occurrences of this code.