On Wed, 2 Dec 2026 02:46:12 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). > Hello [@xiaotaonan](https://github.com/xiaotaonan), as a general suggestion > to several of the current open PRs, please add a PR description explaining > what the fix/change is about and what testing has been done locally with the > change. 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. ------------- PR Comment: https://git.openjdk.org/jdk/pull/34176#issuecomment-7336469387
