On Mon, 26 Oct 2026 08:19:38 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: > > ProcessPath.c has similar code Changes requested by avu (Committer). src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c line 1794: > 1792: if ((PTR)->plgPnts == (PTR)->dfPlgPnts) { > \ > 1793: Point* _newp = (Point*)malloc(newMax*sizeof(Point)); > \ > 1794: if (_newp == NULL) break; > \ If we want to add this check, we should properly recover from the allocation failure: return an error code to the caller and handle it there. Otherwise, we’re just silencing the warning. ------------- PR Review: https://git.openjdk.org/jdk/pull/33513#pullrequestreview-5664587694 PR Review Comment: https://git.openjdk.org/jdk/pull/33513#discussion_r4386831370
