Fix Base64 padding separated by whitespace - #1491
Merged
SGSSGene merged 1 commit intoSep 8, 2026
Merged
Conversation
Track the previous non-whitespace Base64 character when deciding whether padding terminates a decoded byte. This preserves YAML 1.1 !!binary decoding when whitespace appears between padding characters. Cover whitespace-separated padding with a focused test that preserves the single-byte result for the canonical padded form. Reference verification: - PyYAML 6.0.3 (YAML 1.1 !!binary, native value): matched 4d. - libyaml 0.2.5 (parser/event layer): matched the yaml-cpp event stream.
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.
Summary
Fix Base64 decoding when whitespace separates padding characters.
DecodeBase64("TQ= =")previously emitted an extra zero byte because itchecked the raw preceding input character after whitespace had been skipped.
The decoder now tracks whether the previous non-whitespace Base64 character
was padding. The focused test verifies that the result remains the single byte
M.Validation
clang-format, clang-tidy, exhaustive cppcheck, Bazel, and Bzlmod passed.
!!binarynative-value semantics, matchedthe decoded byte
4d.