[PATCH] D86847: [Bitcode] Add BITCODE_SIZE_BLOCK_ID to encode the size of the bitcode
Douglas Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 30 22:29:20 PDT 2020
dougpuob added inline comments.
================
Comment at: llvm/lib/Bitcode/Reader/BitcodeReader.cpp:6504-6505
while (true) {
uint64_t BCBegin = Stream.getCurrentByteNo();
+ if (BCBegin >= Size) {
+ if (BCBegin == Size) {
----------------
MaskRay wrote:
> dougpuob wrote:
> > About the boundary checking issue, unsigned integer wrapping. Is it possible that the `BCBegin` is greater than `Size`? if so, is it possible that the `return error() path will be executed?
> >
> > I'm a naive to compiler, just curious about it.
> The check is to catch erroneous cases (if `Size` in BITCODE_SIZE_BLOCK_ID block is incorrectly set). Otherwise it is difficult to catch such errors.
Got it, thank you :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86847/new/
https://reviews.llvm.org/D86847
More information about the llvm-commits
mailing list