ReadCompactSize without range check

Sep 2 - Sep 2, 2024

  • The `ReadCompactSize` function, as defined in `serialize.h`, includes an optional `range_check` parameter that is set to `true` by default.

This setting ensures that the value read by the function does not exceed 0x02000000, effectively enforcing a limit that keeps the compact size value within the bounds of a 32-bit unsigned integer. An examination of the codebase reveals that there are no instances where ReadCompactSize is invoked with the range_check parameter set to false. This information raises a pertinent inquiry regarding the necessity of adhering to the constraints of a 32-bit integer for values encoded using CompactSize, and questions the utility of the 0xFF or 9-byte encoding scheme for compact sizes, suggesting a potential reevaluation of whether this approach remains necessary.

Link to Raw Post
Bitcoin Logo

TLDR

Join Our Newsletter

We’ll email you summaries of the latest discussions from high signal bitcoin sources, like bitcoin-dev, lightning-dev, and Delving Bitcoin.

Explore all Products

ChatBTC imageBitcoin searchBitcoin TranscriptsSaving SatoshiDecoding BitcoinWarnet
Built with 🧡 by the Bitcoin Dev Project
View our public visitor count

We'd love to hear your feedback on this project.

Give Feedback