RFR: 8304837: Classfile API throws IOOBE for MethodParameters attribute without parameter names
Chen Liang
liach at openjdk.org
Thu Mar 23 20:18:20 UTC 2023
On Thu, 23 Mar 2023 19:45:21 GMT, Hannes Greule <duke at openjdk.org> wrote:
> After merging master into https://github.com/openjdk/jdk/pull/9862, we encountered test failures (e.g., https://github.com/SirYwell/jdk/actions/runs/4500940829/jobs/7923018438#step:9:2541). The Classfile API tries to read from constant pool index 0 if a MethodParameters attribute has an entry without name.
>
> The fix is simply using `readUtf8EntryOrNull` instead of `readUtf8Entry`. The related code already correctly handles nullability.
>
> I didn't find an appropriate test class so I added a new one. Let me know if there's a better place or if the test can be improved somehow.
>
> As I don't have a JBS account, someone needs to create a bug report there for me. Thanks.
Nice catch, issue opened at https://bugs.openjdk.org/browse/JDK-8304837 and marked as blocking compiler changes.
src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java line 2:
> 1: /*
> 2: * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
Suggestion:
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
test/jdk/jdk/classfile/BoundAttributeTest.java line 46:
> 44: /*
> 45: * @test
> 46: * @summary Testing BoundAttributes
Suggestion:
* @issue 8304837
* @summary Testing BoundAttributes
now that I've created an issue for you.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13167#issuecomment-1481828277
PR Review Comment: https://git.openjdk.org/jdk/pull/13167#discussion_r1146773987
PR Review Comment: https://git.openjdk.org/jdk/pull/13167#discussion_r1146775648
More information about the core-libs-dev
mailing list