On Wed, 25 Nov 2026 14:28:54 GMT, Matthias Baesken <[email protected]> wrote:
> There are a couple of FormatMessage calls in awt using > FORMAT_MESSAGE_ALLOCATE_BUFFER. > Those could run potentially into allocation failures, so they should check > return values to not use unallocated memory in the wrong way. > Additionally we should probably call the functions with > FORMAT_MESSAGE_IGNORE_INSERTS because the arguments parameter is currently > NULL anyways. > > And the manpage says : > https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-formatmessage > Security Remarks > If this function is called without FORMAT_MESSAGE_IGNORE_INSERTS, the > Arguments parameter must contain enough parameters to satisfy all insertion > sequences in the message string, and they must be of the correct type. > > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). We throw a C++ exception; seems those are handled higher up in the call chain, where we have related catch-blocks https://github.com/openjdk/jdk/blob/86a0b51c68ef39fc7f8e3c762aba09a018808476/src/java.desktop/windows/native/libawt/windows/awt_PopupMenu.cpp#L91 https://github.com/openjdk/jdk/blob/86a0b51c68ef39fc7f8e3c762aba09a018808476/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp#L101 ------------- PR Comment: https://git.openjdk.org/jdk/pull/34067#issuecomment-7219700125
