https://bz.apache.org/bugzilla/show_bug.cgi?id=61993
Bug ID: 61993
Summary: org.apache.tomcat.util.ByteChunk throws NegativeArray
SizeException
Product: Tomcat 7
Version: 7.0.82
Hardware: PC
OS: Linux
Status: NEW
Keywords: Beginner, PatchAvailable, PortForward
Severity: minor
Priority: P2
Component: Catalina
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 35675
--> https://bz.apache.org/bugzilla/attachment.cgi?id=35675&action=edit
If growing the buffer would overflow int then just set to max value
We use ByteChunk to read in the request body and we noticed 2 things.
1.) The length of ByteChunk is limited to MAX_INT so for our purposes we can
only process 2Gb requests before we need to alter our reading code.
2.) The way that ByteChunk grows means that in practice you can often only use
up to 1Gb of space.
The followign exception stack is thrown when append is called on and ByteChunk
over 1Gb in size:
java.lang.NegativeArraySizeException:java.lang.NegativeArraySizeException at
org.apache.tomcat.util.buf.ByteChunk.makeSpace(ByteChunk.java:527) at
org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:327)
Looking at issue number 1 it looks like a lot of classes would need to be
changed to use long but I do have a patch for a trivial check that allowed us
to process 2Gb requests.
Obviously this could silently truncate once you actually reach INT_MAX but it
seems from the previous check based on the limit that this is the desired
behaviour rather than to throw an exception.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]