Skip to content

base64: don't drop already-decoded output when decoding hits invalid input - #13314

Open
Chaganti-Reddy wants to merge 5 commits into
uutils:mainfrom
Chaganti-Reddy:base64-partial-decode-on-error
Open

Chaganti-Reddy wants to merge 5 commits into
uutils:mainfrom
Chaganti-Reddy:base64-partial-decode-on-error

Conversation

@Chaganti-Reddy

Copy link
Copy Markdown
Contributor

base64 -d was throwing away everything it had already decoded whenever it hit invalid input later in the stream, instead of writing out the good prefix like GNU does. root cause was two spots that only flushed whole internal batches instead of whatever complete groups were actually buffered, plus base64's decoder rejecting a trailing group with non-canonical padding bits that GNU still accepts.

Fixes #12923

@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/tail-n0f (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/expand/bounded-memory is now passing!
Congrats! The gnu test tests/rm/many-dir-entries-vs-OOM is now passing!

@codspeed

codspeed Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 32.13%

⚡ 2 improved benchmarks
❌ 1 regressed benchmark
✅ 394 untouched benchmarks
🆕 2 new benchmarks
⏩ 54 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation three_39_bit_primes 228.6 ms 797.8 ms -71.35%
⚡ Simulation du_wide_tree[(5000, 500)] 15.9 ms 15.2 ms +4.56%
⚡ Simulation tr_single_char_replace 14.5 ms 13.9 ms +4.36%
🆕 Memory tr_delete_single_char N/A 35.4 KB N/A
🆕 Simulation tr_delete_single_char N/A 103.9 ms N/A

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing Chaganti-Reddy:base64-partial-decode-on-error (3c6673a) with main (a185142)2

Open in CodSpeed

Footnotes

  1. 54 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (9768800) during the generation of this report, so a185142 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@Chaganti-Reddy
Chaganti-Reddy force-pushed the base64-partial-decode-on-error branch from 7b62903 to 0fec3f0 Compare July 8, 2026 14:05
@sylvestre
sylvestre force-pushed the base64-partial-decode-on-error branch from c188b05 to 9d210b8 Compare October 4, 2026 18:13

This branch has not been deployed

No deployments
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.

base64: Unexpected result when decoding data with garbage

1 participant