On Fri, 5 Apr 2024 17:44:38 GMT, Roger Riggs wrote:
> When encoding a vary large string in String.getBytes(StandardCharset.UTF_8)
> computation of the buffer size may exceed the range of a positive 32-bit
> Integer.
> If the estimated size for the result byte array is too large, pre-compute the
On Mon, 8 Apr 2024 13:46:03 GMT, Roger Riggs wrote:
>> Indeed, different OOMEs are thrown in the two cases triggered by different
>> limits, min +2 is due to integer overflow, while min +1 is due a VM limit
>> on the size of byte[Integer.MAX_VALUE]. Different VM implementations may
>> have di
On Mon, 8 Apr 2024 13:39:34 GMT, Roger Riggs wrote:
>> test/jdk/java/lang/String/CompactString/MaxSizeUTF16String.java line 143:
>>
>>> 141: // Strings of size min+1...min+2, throw OOME
>>> 142: // The resulting byte array would exceed implementation limits
>>> 143: for (
On Mon, 8 Apr 2024 08:54:21 GMT, Raffaello Giulietti
wrote:
>> When encoding a vary large string in String.getBytes(StandardCharset.UTF_8)
>> computation of the buffer size may exceed the range of a positive 32-bit
>> Integer.
>> If the estimated size for the result byte array is too large, pr
On Fri, 5 Apr 2024 17:44:38 GMT, Roger Riggs wrote:
> When encoding a vary large string in String.getBytes(StandardCharset.UTF_8)
> computation of the buffer size may exceed the range of a positive 32-bit
> Integer.
> If the estimated size for the result byte array is too large, pre-compute the
On Fri, 5 Apr 2024 21:57:15 GMT, Roger Riggs wrote:
> The test doesn't run quickly already due to the large chunks of memory used.
OK, never mind then, if it would take considerable time.
-
PR Comment: https://git.openjdk.org/jdk/pull/18663#issuecomment-2040706486
On Fri, 5 Apr 2024 20:17:39 GMT, Naoto Sato wrote:
> LGTM. The test case could be more thorough if it tests strings with
> supplementary codepoints, as the new method computes them exclusively.
I considered that, but the worst case is the x3 expansion.
A 2 character high/low surrogate pair wou
On Fri, 5 Apr 2024 17:44:38 GMT, Roger Riggs wrote:
> When encoding a vary large string in String.getBytes(StandardCharset.UTF_8)
> computation of the buffer size may exceed the range of a positive 32-bit
> Integer.
> If the estimated size for the result byte array is too large, pre-compute the
When encoding a vary large string in String.getBytes(StandardCharset.UTF_8)
computation of the buffer size may exceed the range of a positive 32-bit
Integer.
If the estimated size for the result byte array is too large, pre-compute the
exact buffer size.
If that exceeds the range, then throw Ou