Skip to content

{Boolean,Byte,Char,Double,Float,Int,Long,Short}s.concat() may throw {NegativeArraySize,ArrayIndexOutOfBounds}Exception #3303

@ineuwirth

Description

@ineuwirth

The concat() method in the per-type primitive utility classes throws unexpected NegativeArraySizeException or ArrayIndexOutOfBoundsException if the input arrays contain too many elements.

NegativeArraySizeException is being thrown if there is an overflow ending up with a negative int. 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-negative int. In this case, the result array will be shorter than expected and System.arraycopy() will throw AIOOBE.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions