On Fri, 23 Oct 2026 09:19:32 GMT, Matthias Baesken <[email protected]> wrote:

>> The gcc static analyzer reports this issue :
>> 
>> `src/java.desktop/unix/native/common/java2d/x11/X11Renderer.c:86:17: 
>> warning: use of possibly-NULL 'malloc((long unsigned int)newMax * 4)' where 
>> non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]`
>> 
>> Seems we miss NULL checks in the XDHD_ADD_POINT macro (for malloc).
>> 
>> While at it, should I NULL check realloc too?
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Matthias Baesken has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Check realloc result too, break out if malloc/realloc fails

While at it, I noticed that we have similar coding here
https://github.com/openjdk/jdk/blob/fa970a38bf65ccf3bf09c333eeb4bf5e0cf2e273/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c#L1786-L1800

where malloc/realloc results miss NULL-checks. Should I create a new JBS issue 
for this one or  fix it here too?

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

PR Comment: https://git.openjdk.org/jdk/pull/33513#issuecomment-6365759952

Reply via email to