-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{Boolean,Byte,Char,Double,Float,Int,Long,Short}s.concat() may throw {NegativeArraySize,ArrayIndexOutOfBounds}Exception #3303
Comments
… unexpected `NegativeArraySizeException` or `ArrayIndexOutOfBoundsException` if the input arrays contain too many elements. Added test cases to demonstrate both overflow cases. Possible fix is provided. In this commit only the module `guava` and only the utility class `Longs` is covered along with its unit tests. See google#3303
Test cases to demonstrate the issue can be found in #3304. I am happy to cover other classes and modules (android, gwt) as well if you think the test cases/provided fix are good. |
… unexpected `NegativeArraySizeException` or `ArrayIndexOutOfBoundsException` if the input arrays contain too many elements. De-duplicate unit test code. See google#3303
This isn't actually a bug, right? It's just improving the API docs? |
Well, a similar issue has been fixed in code instead of documenting the behavior e.g. in #3026. |
… arrays contain too many elements. Fixes #7376 Fixes #3303 This change comes from @perceptron8, who generalized the earlier PR by @ineuwirth. RELNOTES=n/a PiperOrigin-RevId: 667983976
… arrays contain too many elements. Fixes #7376 Fixes #3303 This change comes from @perceptron8, who generalized the earlier PR by @ineuwirth. RELNOTES=n/a PiperOrigin-RevId: 667983976
I think the PR from last year and the followup today have covered all this, but let me know if I'm missing anything. |
The
concat()
method in the per-type primitive utility classes throws unexpectedNegativeArraySizeException
orArrayIndexOutOfBoundsException
if the input arrays contain too many elements.NegativeArraySizeException
is being thrown if there is an overflow ending up with a negativeint
. In this case, the result array cannot be constructed with this number.ArrayIndexOutOfBoundsException
is being thrown if there is an overflow ending up with a non-negativeint
. In this case, the result array will be shorter than expected andSystem.arraycopy()
will throwAIOOBE
.The text was updated successfully, but these errors were encountered: