[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 00:07:14 PDT 2020


dougpuob added inline comments.


================
Comment at: llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp:84
+  case bitc::BITCODE_SIZE_BLOCK_ID:
+    return "BITCODE_SIZE_BLOCK_ID";
   }
----------------
Seems like a typo.


================
Comment at: llvm/lib/Bitcode/Reader/BitcodeReader.cpp:6504-6505
   while (true) {
     uint64_t BCBegin = Stream.getCurrentByteNo();
+    if (BCBegin >= Size) {
+      if (BCBegin == Size) {
----------------
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.


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