RFR: 8325002: Exceptions::fthrow needs to ensure it truncates to a valid utf8 string

David Holmes dholmes at openjdk.org
Fri Jul 26 04:08:59 UTC 2024


Exceptions::fthrow uses a 1024 byte buffer to format the incoming exception message string, but this may not be large enough, leading to truncation. However, we should ensure we truncate to a valid UTF8 sequence.

The process is explained in the code. Thanks to @RogerRiggs and @djelinski for their suggestions on how to tackle this.

Testing:
 - new gtest exercises the truncation code with the different possibilities for bad truncation
 - tiers 1-3 sanity testing

Thanks.

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

Commit messages:
 - Fixed typo
 - 8325002: Exceptions::fthrow needs to ensure it truncates to a valid utf8 string

Changes: https://git.openjdk.org/jdk/pull/20345/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20345&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8325002
  Stats: 180 lines in 4 files changed: 177 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/20345.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20345/head:pull/20345

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


More information about the hotspot-dev mailing list