[llvm] [BitstreamReader] Fix 32-bit overflow (PR #117363)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 25 14:58:57 PST 2024
================
@@ -334,7 +334,8 @@ Expected<unsigned> BitstreamCursor::readRecord(unsigned AbbrevID,
----------------
mingmingl-llvm wrote:
The change to {Read,Emit}VBR64(6) looks backward compatible to me as well, and https://llvm.org/docs/BitCodeFormat.html#define-abbrev-encoding needs an update around _Blob (code 5): This field is emitted as a vbr6, followed by padding to a 32-bit boundary (for alignment) and an array of 8-bit objects_ It's not clear to me (from the doc and code comment around) how 32-bit alignment is related with value width (32 vs 64) and whether alignment needs an update for 4GB+ blobs.
If we decide not to support 4GB blob soon, I think emitting a release-build visible warning (e.g., by LLVMContext's diagnostic handler) when blob size is larger than 4GB around https://github.com/llvm/llvm-project/blob/76f0ff8210d56a050d2679926a2fdddd3a8c16d6/llvm/include/llvm/Bitstream/BitstreamWriter.h#L550 is generally a good change (makes investigation easier).
https://github.com/llvm/llvm-project/pull/117363
More information about the llvm-commits
mailing list