RFR: 8320222: Wrong bytecode accepted, and StackMap table generated

Adam Sotona asotona at openjdk.org
Thu Nov 16 10:07:48 UTC 2023


Stack map generator in ClassFile API performs only minimal checks in favour of performance.
However it led to situations where it generates invalid stack maps for corrupted code.
This patch adds basic checks of stack when two frames are merged and throws an exception in case of stack size or content mismatch. Generated or transformed code with inconsistent stack will fail on stack maps generation.
Relevant tests are added.

Please review.

Thanks,
Adam

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

Commit messages:
 - 8320222: Wrong bytecode accepted, and StackMap table generated

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

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


More information about the core-libs-dev mailing list