On Fri, 31 Jul 2026 17:36:48 GMT, Phil Race <[email protected]> wrote:
>> We miss to check the rv of GlobalAlloc at one code location, this should >> better be adjusted. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp line 4268: > >> 4266: } >> 4267: >> 4268: DEVNAMES* pDevNames = (DEVNAMES*)::GlobalLock(hDevNames); > > If we are going to do the check on alloc, we should also do the check on > lock, like done for pDevMode at line 4237. That's a good point! The documentation says https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-globallock " If the function succeeds, the return value is a pointer to the first byte of the memory block. If the function fails, the return value is NULL." So it can fail and better should be checked ! ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32151#discussion_r3702013009
