Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for CBOR big integers represented as indefinite-length byte strings, according to the CBOR specification. The implementation handles both positive (tag 2) and negative (tag 3) big integers when they use indefinite-length encoding (0x5f byte header).
- Adds new data constructors
BigUIntNeedBytesandBigNIntNeedBytesto handle indefinite-length byte string representation of big integers - Implements detection and processing of indefinite-length byte strings in big integer decoding paths (both fast and slow paths)
- Rejects indefinite-length encoding in canonical mode as it is non-canonical
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ab98109 to
4c1a0a3
Compare
nc6
reviewed
Nov 12, 2025
nc6
left a comment
There was a problem hiding this comment.
Some name fixes and documentation can be tidied, but all looks good otherwise from my POV
4c1a0a3 to
6ee5d39
Compare
We support indefinite length bytestring in the Read module. In order to do it we add two extra variants for bigint deseralization, both puts us to the slow-path to start consumption of the chunks. This serialization is considered non-canonical thus canonical read rejects is. While specification is silent about it, the cbor.me implementation always converts bigit into a fixed size byte blob. Fixes well-typed#263.
6ee5d39 to
10c56f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We support indefinite length bytestring in the Read module.