On 6/20/19 9:31 PM, Peter Levart wrote: > I would also add overflow checks when computing the length of > resulting byte[]. First I would pre-check the length of passed in > int[] array (it must be less than Integer.MAX_VALUE / 3), then > checking for negative size after each addition of element length, > throwing OOME if overflow happens.
OutOfMemoryException? Are you sure? The system isn't out of memory or any other resource, it's just that the arguments are too large. Also, it might be cleaner to use addExact(). -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. <https://www.redhat.com> https://keybase.io/andrewhaley EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671