Skip to content

catch invalid base64 in MimeUtility encoded-word decoder#1013

Closed
sahvx655-wq wants to merge 1 commit into
apache:mainfrom
sahvx655-wq:mime-decode-word-base64-iae
Closed

catch invalid base64 in MimeUtility encoded-word decoder#1013
sahvx655-wq wants to merge 1 commit into
apache:mainfrom
sahvx655-wq:mime-decode-word-base64-iae

Conversation

@sahvx655-wq
Copy link
Copy Markdown
Contributor

Base64.getDecoder().decode throws IllegalArgumentException, not IOException, so a Content-Disposition param like filename="=?utf-8?B?@@@@?=" lets the unchecked exception escape decodeWord and ParameterParser.parse straight out of multipart parsing, where the only catch handlers are for IOException/IllegalStateException. Adding it to the existing catch keeps the contract that decodeWord throws UnsupportedEncodingException for malformed encodings, which decodeText/ParameterParser already handle by keeping the raw value.

Base64.getDecoder().decode throws IllegalArgumentException rather than
IOException, so a malformed RFC 2047 encoded-word in a Content-Disposition
filename param escaped decodeWord and ParameterParser.parse as an
unchecked exception. Add it to the existing catch so it surfaces as the
documented UnsupportedEncodingException.
@markt-asf
Copy link
Copy Markdown
Contributor

This is a package renamed fork of Commons File Upload. Any changes need to be made in that project and then Tomcat will pick up those changes when it is next released.

@markt-asf markt-asf closed this May 28, 2026
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