llvm.org GIT mirror llvm / 6aeb31b
BitstreamWriter: Fix integer overflow. We were previously overflowing a 32-bit multiply operation when emitting large (>512MB) bitcode files, resulting in corrupted bitcode. Fix by extending one of the operands to 64 bits. There are a few other 32-bit integer types in this code that seem like they also ought to be extended to 64 bits; this will be done separately. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251323 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 5 years ago
1 changed file(s) with 1 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
242242
243243 // Compute the size of the block, in words, not counting the size field.
244244 unsigned SizeInWords = GetWordIndex() - B.StartSizeWord - 1;
245 uint64_t BitNo = B.StartSizeWord * 32;
245 uint64_t BitNo = uint64_t(B.StartSizeWord) * 32;
246246
247247 // Update the block size field in the header of this sub-block.
248248 BackpatchWord(BitNo, SizeInWords);