Skip to content

Document the input chunk alignment for decode_mut - #180

Merged
ia0 merged 4 commits into
ia0:mainfrom
riha-dev:decode-align
Oct 14, 2026
Merged

ia0 merged 4 commits into
ia0:mainfrom
riha-dev:decode-align

Conversation

@riha-dev

@riha-dev riha-dev commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

decode_len documents chunk-by-chunk decoding but omits the chunk alignment that encode_len documents, so an unpadded base whose bit-width does not divide 8 decodes a trailing partial group of symbols as the end of the input and silently drops the rest (BASE64_NOPAD fed AQ then AA gives [1, 0], where decode(b"AQAA") gives [1, 0, 0]); decode_align now provides that alignment, mirroring encode_align.

@ia0 ia0 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! The test is a bit too exhaustive (and looks more like fuzzing). It think it's enough to have just a few cases with a single encoding.

Comment thread lib/tests/lib.rs

@ia0 ia0 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@ia0
ia0 merged commit 53e2ff6 into ia0:main Oct 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants