[PATCH] D86500: Fix a 32-bit overflow issue when reading LTO-generated bitcode files whose strtab are of size > 2^29

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 17:54:29 PDT 2020


MaskRay added inline comments.


================
Comment at: llvm/lib/Bitstream/Reader/BitstreamReader.cpp:190
     // Figure out where the end of this blob will be including tail padding.
-    size_t NewEnd = GetCurrentBitNo()+((NumElts+3)&~3)*8;
+    size_t NewEnd =
+        GetCurrentBitNo() + ((static_cast<uint64_t>(NumElts) + 3) & ~3) * 8;
----------------
`const size_t` while you are updating it


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86500



More information about the llvm-commits mailing list