RFR: 8275846: read_base_archive_name() could read past the end of buffer

Ioi Lam iklam at openjdk.java.net
Fri Nov 5 20:26:07 UTC 2021


Please review this small fix for an intermittent crash in `FileHeaderHelper::read_base_archive_name()`. The crash happens if a string stored inside a CDS dynamic archive is not zero-terminated.

The fix is to check for zero-termination, and that the actual string length matches with the the recorded length.

This fix was authored by @yqi in PR #5991 , but that PR may take longer to integrate than expected. So let's fix the crash first.

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

Commit messages:
 - remove unnecessary type cast
 - 8275846: read_base_archive_name() could read past the end of buffer

Changes: https://git.openjdk.java.net/jdk/pull/6285/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6285&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8275846
  Stats: 22 lines in 2 files changed: 5 ins; 1 del; 16 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6285.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6285/head:pull/6285

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


More information about the hotspot-runtime-dev mailing list