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).

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

Commit messages:
 - JDK-8398332

Changes: https://git.openjdk.org/jdk/pull/34067/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=34067&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8398332
  Stats: 32 lines in 2 files changed: 8 ins; 5 del; 19 mod
  Patch: https://git.openjdk.org/jdk/pull/34067.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/34067/head:pull/34067

PR: https://git.openjdk.org/jdk/pull/34067

Reply via email to