Skip to content

MimeTypeUtils raises StringIndexOutOfBoundsException for some invalid mime types #36971

Description

@JGiard

Since version 7.0.8 of spring-core and the bug fix in commit 41cd687, MimeTypeUtils raises a StringIndexOutOfBoundsException instead of an InvalidMimeTypeException when parsing certain invalid mime types.

Attempting to parse "application/xml" (the quotes are part of the value) raises a StringIndexOutOfBoundsException and Spring returns a 500 internal server error.

I believe there is an unaccounted case where nextIndex = 0 in mimeType.charAt(nextIndex - 1) if the value starts with a double quote.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions