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 160:

> 158:             return attro.map(attr -> ((BoundAttribute) 
> attr).contents()).orElse(null);
> 159:         }
> 160:         boolean isOverpass() {

@asotona I have added the Overpass method here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/34176#discussion_r4769790273

Reply via email to