RFR: 8308549: Classfile API should fail to generate over-sized Code attribute

Adam Sotona asotona at openjdk.org
Tue May 23 15:10:41 UTC 2023


Classfile API allowed to generate Code attribute exceeding the 65k limit. No exception has been thrown during class generation and the class failed verification later during class loading.
This patch adds Code size limit check throwing IllegalArgumentException.
The patch also adds similar check for constant pool size limit to avoid generation class file with corrupted  constant pool.
Two new tests are added to check response on oversized Code attribute and constant pool.
`VerifierImpl` is extended to check Code attribute size as a part of class verification process.

Please review.

Thanks,
Adam

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

Commit messages:
 - 8308549: Classfile API should fail to generate over-sized Code attribute

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

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


More information about the core-libs-dev mailing list