[PATCH] D86847: [Bitcode] Add BITCODE_SIZE_BLOCK_ID to encode the size of the bitcode

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 30 00:09:05 PDT 2020


MaskRay marked an inline comment as done.
MaskRay 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) {
----------------
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.


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