RFR: JDK-8285712: LogMessageBuffer doesn't check vsnprintf return value

Johan Sjölén duke at openjdk.java.net
Wed Apr 27 22:33:05 UTC 2022


os::vsnprintf can return a negative value on encoding error. A negative return value will cause wraparound when cast to size_t. This in turn causes LogMessageBuffer::grow() to attempt a large memory allocation. Instead of accepting this we bail on the logging.

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

Commit messages:
 - JDK-8285712: Bail if os::vsnprintf fails during logging

Changes: https://git.openjdk.java.net/jdk/pull/8423/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8423&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8285712
  Stats: 8 lines in 1 file changed: 7 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8423.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8423/head:pull/8423

PR: https://git.openjdk.java.net/jdk/pull/8423


More information about the hotspot-runtime-dev mailing list