Skip to content

Conversation

@reschke
Copy link
Contributor

@reschke reschke commented Feb 4, 2026

No description provided.

@reschke reschke marked this pull request as draft February 4, 2026 17:21
…tly - minimal change to handle missing padding (instead of returning garbage)
@reschke reschke self-assigned this Feb 4, 2026
@reschke reschke marked this pull request as ready for review February 4, 2026 17:50
@reschke reschke requested review from kwin and mbaedke February 4, 2026 18:10
Copy link
Member

@kwin kwin left a comment

Choose a reason for hiding this comment

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

LGTM

// handle missing padding gracefully, inspired by
// https://datatracker.ietf.org/doc/html/rfc7515#appendix-C
if (posChunk == 1) {
throw new IllegalArgumentException("specified data is not base64 encoded");
Copy link
Member

Choose a reason for hiding this comment

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

Any test for this IAE?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TDB

The weird thing is that in case of IAEs, the (existing) code does return the input string (who knows why)

@reschke
Copy link
Contributor Author

reschke commented Feb 4, 2026

... while we're at it, we may want to improve the Javadoc.

@reschke reschke changed the title JCR-5226: Base64 decoder does not handle input without padding correctly JCR-5226: Base64 decoder does not handle incorrect or lack of padding correctly Feb 5, 2026
@reschke reschke marked this pull request as draft February 5, 2026 07:47
@reschke
Copy link
Contributor Author

reschke commented Feb 5, 2026

There are more bugs (decoding "a=b" etc); but these fall into the category "garbage in, garbage out", not "correct input, garbage out).

@reschke reschke changed the title JCR-5226: Base64 decoder does not handle incorrect or lack of padding correctly JCR-5226: Base64 decoder does not handle lack of padding correctly Feb 5, 2026
@reschke reschke requested a review from kwin February 5, 2026 12:29
@reschke reschke marked this pull request as ready for review February 5, 2026 12:29
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 5, 2026

@reschke reschke merged commit 78d59df into trunk Feb 9, 2026
4 checks passed
@reschke reschke deleted the JCR-5226 branch February 9, 2026 17:03
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