hryx / llvm-bitcode

Experimental LLVM bitcode reader/writer
MIT License
20 stars 0 forks source link

Prevent invalid VBRs from causing overflow #1

Open hryx opened 1 year ago

hryx commented 1 year ago

The "more" bit in a VBR chunk indicates that there are more chunks to parse, which are then shifted and added to the final value.

A valid VBR can represent at most a 64-bit number, but the bitstream reader currently does not stop shifting/adding as long as there is still a "more" bit on a chunk, which will cause integer overflow for excessively long VBRs.