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). I checked again and calling LocalFree with argument NULL should be okay https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-localfree So we initialize the buf pointers correctly to NULL before going into the FormatMessage function, means we can continue calling LocalFree as it is now. Guess I can close the PR in this case. ------------- PR Comment: https://git.openjdk.org/jdk/pull/34067#issuecomment-7215748658
