On Wed, 2 Dec 2026 06:53:53 GMT, xiaotaonan <[email protected]> wrote:
>> The Classfile API verifier (`VerifierImpl`) currently skips methods marked >> with `ACC_BRIDGE` during verification. This is inconsistent with HotSpot's >> verifier, which only skips overpass methods (VM-generated) and still >> verifies ordinary bridge methods. >> >> A maliciously crafted class file could therefore mark a method with >> `ACC_BRIDGE` to bypass verification entirely. >> >> This fix aligns the Classfile API verifier with HotSpot by replacing the >> `isBridge()` check with an equivalent overpass check. >> >> Testing: >> - Added a regression test that constructs a class file with an invalid >> method body marked `ACC_BRIDGE`, and verifies that the Classfile API >> verifier now rejects it. >> - Ran the existing `java/lang/classfile` and `jdk/internal/classfile` tests. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > xiaotaonan has updated the pull request incrementally with one additional > commit since the last revision: > > fix: Modify according to the review comments. src/java.base/share/classes/jdk/internal/classfile/impl/verifier/VerificationWrapper.java line 162: > 160: boolean isOverpass() { > 161: return m.flags().has(AccessFlag.BRIDGE) && > m.flags().has(AccessFlag.SYNTHETIC); > 162: } Suggestion: ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/34176#discussion_r4775216115
