RFR: 8306461: ObjectInputStream::readObject() should handle negative array sizes without throwing NegativeArraySizeExceptions [v4]

Volker Simonis simonis at openjdk.org
Tue May 2 17:30:23 UTC 2023


On Tue, 2 May 2023 16:06:50 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Volker Simonis has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Throw StreamCorruptedException instead of InvalidClassException and handle negative array size in checkArray() as well
>
> test/jdk/java/io/ObjectInputStream/NegativeArraySizeTest.java line 46:
> 
>> 44:     private static byte[] buildArrayPayload() throws IOException {
>> 45:          // Serialize to bytes
>> 46:         ByteArrayOutputStream baos = new ByteArrayOutputStream();
> 
> Suggestion:
> 
>     private static byte[] buildArrayPayload() throws IOException {
>         // Serialize to bytes
>         ByteArrayOutputStream baos = new ByteArrayOutputStream();

You're right. An for some strange reason the same comment  in `buildPriorityQueuePayload()` is correctly indented but the following code was not. So fixed that as well.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13540#discussion_r1182841247


More information about the core-libs-dev mailing list