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

Calvin Cheung ccheung at openjdk.java.net
Sat Nov 6 01:27:37 UTC 2021


On Fri, 5 Nov 2021 20:11:10 GMT, Ioi Lam <iklam at openjdk.org> wrote:

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

Changes look good. Just one comment on the test.
Also, the description of this PR mentions PR #5991, I think you meant PR #5997?
thanks,
Calvin

test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/ArchiveConsistency.java line 156:

> 154:                appJar, mainClass, 1,
> 155:                new String[] {"Base archive name is damaged",
> 156:                              "Header checksum verification failed"});

It would be good if there's a testcase to cover the "does not exist" case.
It's fine if it will be covered by PR #5997.

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

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


More information about the hotspot-runtime-dev mailing list