RFR: 8283225: [AIX] ClassLoader.c produces incorrect OutOfMemory Exception when length is 0 [v2]

Tyler Steele duke at openjdk.java.net
Wed Mar 16 20:40:47 UTC 2022


On Wed, 16 Mar 2022 20:17:50 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Tyler Steele has updated the pull request incrementally with four additional commits since the last revision:
>> 
>>  - Fixes type warning.
>>  - Removes unneeded ClassFormatError from ClassLoader.c
>>  - Revert "Extract memory error logic to helper procedure"
>>    
>>    This reverts commit b631eb0ccd5f3748c2010c864f8ccef0c1da9c42.
>>  - Avoid calling malloc with size zero.
>
> src/java.base/share/native/libjava/ClassLoader.c line 106:
> 
>> 104:     // NULL or a unique non-NULL pointer. To unify libc behavior across our platforms
>> 105:     // we chose the latter. (see 8283225)
>> 106:     body = (jbyte *)malloc(length < 1 ? 1 : length);
> 
> This code conflates a length == in the comment with length < 1 in the code.
> If the issue is with length == 0, make that be the test.

Thanks for your comment. I agree, and will make this change.

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

PR: https://git.openjdk.java.net/jdk/pull/7829


More information about the core-libs-dev mailing list