Skip to content

Fixes validation of input bytes in the Base64 decoder#9623

Merged
normanmaurer merged 1 commit intonetty:masterfrom
fenik17:base64_decoder_validation
Oct 10, 2019
Merged

Fixes validation of input bytes in the Base64 decoder#9623
normanmaurer merged 1 commit intonetty:masterfrom
fenik17:base64_decoder_validation

Conversation

@fenik17
Copy link
Copy Markdown
Contributor

@fenik17 fenik17 commented Sep 29, 2019

Motivation:
In the current implementation of Base64 decoder an invalid character ½ (\u00BD) is treated as =. Also the character \u007F leads to ArrayIndexOutOfBoundsException.

Modification:
Explicitly checks that all input bytes are ASCII characters (greater than zero). Fix decodabet tables.

Result:
Correctly validation input bytes in Base64 decoder.

@netty-bot
Copy link
Copy Markdown

Can one of the admins verify this patch?

Copy link
Copy Markdown
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

LGTM

@fenik17
Copy link
Copy Markdown
Contributor Author

fenik17 commented Oct 1, 2019

@njhill thanx! I also fixed an ArrayIndexOutOfBoundsException and squashed commits.

@normanmaurer
Copy link
Copy Markdown
Member

@netty-bot test this pleas

@normanmaurer
Copy link
Copy Markdown
Member

@netty-bot test this please

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please ensure to release all the created ByteBuf instances in a finally block (true for all added tests)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You could also use copiedBuffer(...) to reduce some boilerplate

@fenik17
Copy link
Copy Markdown
Contributor Author

fenik17 commented Oct 7, 2019

@normanmaurer test fixed

@normanmaurer
Copy link
Copy Markdown
Member

@netty-bot test this please

@normanmaurer
Copy link
Copy Markdown
Member

@fenik17 can you please rebase ?

Motivation:
In the current implementation of Base64 decoder an invalid
character `\u00BD` treated as `=`.
Also character `\u007F` leads to ArrayIndexOutOfBoundsException.

Modification:
Explicitly checks that all input bytes are ASCII characters
(greater than zero). Fix `decodabet` tables.

Result:
Correctly validation input bytes in Base64 decoder.
@fenik17
Copy link
Copy Markdown
Contributor Author

fenik17 commented Oct 10, 2019

@normanmaurer rebased

@normanmaurer
Copy link
Copy Markdown
Member

@netty-bot test this please

@normanmaurer normanmaurer merged commit c0f9923 into netty:master Oct 10, 2019
@normanmaurer normanmaurer added this to the 4.1.43.Final milestone Oct 10, 2019
normanmaurer pushed a commit that referenced this pull request Oct 10, 2019
Motivation:
In the current implementation of Base64 decoder an invalid
character `\u00BD` treated as `=`.
Also character `\u007F` leads to ArrayIndexOutOfBoundsException.

Modification:
Explicitly checks that all input bytes are ASCII characters
(greater than zero). Fix `decodabet` tables.

Result:
Correctly validation input bytes in Base64 decoder.
@fenik17 fenik17 deleted the base64_decoder_validation branch October 11, 2019 03:06
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.

4 participants