RFR: 8320360: ClassFile.parse: Some defect class files cause unexpected exceptions to be thrown [v3]

Adam Sotona asotona at openjdk.org
Tue Jan 2 13:02:08 UTC 2024


> ClassFile API throws `IndexOutOfBoundsException` when classfile structure is corrupted so the parser attempts to read beyond the classfile bounds.
> General contract is that only `IllegalArgumentException` or its subclasses is expected when parser fails.
> This patch wraps `IndexOutOfBoundsExceptions` thrown from all `ClassReaderImpl.buffer` manipulations into an  `IllegalArgumentException("Reading beyond classfile bounds", iOOBECause)`.
> Relevant tests are added.
> 
> Please review.
> 
> Thanks,
> Adam

Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:

  updated copyright years

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/16762/files
  - new: https://git.openjdk.org/jdk/pull/16762/files/08bcc548..a16bf6da

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=16762&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=16762&range=01-02

  Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/16762.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16762/head:pull/16762

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


More information about the core-libs-dev mailing list