MockHttpServletRequest#setContentType
fails with StringIndexOutOfBoundsException
#29255
Labels
Milestone
For the default Locale of
en_US
, the following code:fails with:
The problem is that contentType.toLowerCase() changes the length of the String, so when using the index on the original String causes a
StringIndexOutOfBoundsException
.This is causing failures to be reported to Spring Security by the oss-fuzz project which generated random inputs for their test cases which resulted in this error being reported to Spring Security.
While the header is invalid it would be nice to be able to test invalid headers using the mock object.
The text was updated successfully, but these errors were encountered: