Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8304837: Classfile API throws IOOBE for MethodParameters attribute without parameter names #13167

Closed

Conversation

SirYwell
Copy link
Member

@SirYwell SirYwell commented Mar 23, 2023

After merging master into #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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8304837: Classfile API throws IOOBE for MethodParameters attribute without parameter names

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13167/head:pull/13167
$ git checkout pull/13167

Update a local copy of the PR:
$ git checkout pull/13167
$ git pull https://git.openjdk.org/jdk.git pull/13167/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13167

View PR using the GUI difftool:
$ git pr show -t 13167

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13167.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 23, 2023

👋 Welcome back SirYwell! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Mar 23, 2023

@SirYwell The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Mar 23, 2023
@liach
Copy link
Member

liach commented Mar 23, 2023

Nice catch, issue opened at https://bugs.openjdk.org/browse/JDK-8304837 and marked as blocking compiler changes.

@SirYwell SirYwell changed the title Classfile API throws IOOBE for MethodParameters attribute without parameter names 8304837: Classfile API throws IOOBE for MethodParameters attribute without parameter names Mar 23, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 23, 2023
@mlbridge
Copy link

mlbridge bot commented Mar 23, 2023

Webrevs

@TheShermanTanker
Copy link
Contributor

Oops, looks like I was too late to create the issue haha

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
@SirYwell
Copy link
Member Author

Thanks for the review. I moved the comment and changed to @bug.

Copy link
Member

@asotona asotona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good, thank you for finding and fixing the bug.

@TheShermanTanker
Copy link
Contributor

Great work, feel free to @ me if you need a quick sponsor once you integrate it

@jddarcy
Copy link
Member

jddarcy commented Mar 24, 2023

And just to double-check, the JVMS does allow the parameter name information to be missing even if the access flags are defined:
https://docs.oracle.com/javase/specs/jvms/se20/html/jvms-4.html#jvms-4.7.24

name_index

The value of the name_index item must either be zero or a valid index into the constant_pool table.

If the value of the name_index item is zero, then this parameters element indicates a formal parameter with no name.

If the value of the name_index item is nonzero, the constant_pool entry at that index must be a CONSTANT_Utf8_info structure representing a valid unqualified name denoting a formal parameter ([§4.2.2](https://docs.oracle.com/javase/specs/jvms/se20/html/jvms-4.html#jvms-4.2.2)).

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 22, 2023

@SirYwell This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@TheShermanTanker
Copy link
Contributor

Keeping alive

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@openjdk
Copy link

openjdk bot commented Apr 28, 2023

⚠️ @SirYwell the full name on your profile does not match the author name in this pull requests' HEAD commit. If this pull request gets integrated then the author name from this pull requests' HEAD commit will be used for the resulting commit. If you wish to push a new commit with a different author name, then please run the following commands in a local repository of your personal fork:

$ git checkout fix/classfile-nullable-parameter-names
$ git commit --author='Preferred Full Name <you@example.com>' --allow-empty -m 'Update full name'
$ git push

@openjdk
Copy link

openjdk bot commented Apr 28, 2023

@SirYwell This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8304837: Classfile API throws IOOBE for MethodParameters attribute without parameter names

Reviewed-by: asotona, jwaters, vromero

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 489 new commits pushed to the master branch:

  • d43a5a2: 8307135: java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java failed
  • 1f68924: 8306955: Open source several JComboBox jtreg tests
  • b8de394: 8307080: Open source some more JComboBox jtreg tests
  • 4818c79: 8307110: zero build broken after JDK-8304265
  • da9efee: 8296935: Arrays.asList() can return a List that throws undocumented ArrayStoreException
  • 05af487: 8306681: Open source more AWT DnD related tests
  • ec5c792: 8306133: Open source few AWT Drag & Drop related tests
  • 6d6f726: 8307078: Opensource and clean up five more AWT Focus related tests
  • 89711f3: 8307079: Update test java/awt/Choice/DragOffNoSelect.java
  • 9ff5550: 8307077: Convert CRLF to LF in java.xml.crypto
  • ... and 479 more: https://git.openjdk.org/jdk/compare/6fa25cc134e8a6787490e080fb98c2d61cf0b049...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@asotona, @TheShermanTanker, @vicente-romero-oracle) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 28, 2023
@SirYwell
Copy link
Member Author

/integrate

@SirYwell
Copy link
Member Author

Thank you for your review, @vicente-romero-oracle.

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Apr 29, 2023
@openjdk
Copy link

openjdk bot commented Apr 29, 2023

@SirYwell
Your change (at version b77cc1b) is now ready to be sponsored by a Committer.

@TheShermanTanker
Copy link
Contributor

Nice! :)

@TheShermanTanker
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Apr 29, 2023

Going to push as commit a2d3fc8.
Since your change was applied there have been 489 commits pushed to the master branch:

  • d43a5a2: 8307135: java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java failed
  • 1f68924: 8306955: Open source several JComboBox jtreg tests
  • b8de394: 8307080: Open source some more JComboBox jtreg tests
  • 4818c79: 8307110: zero build broken after JDK-8304265
  • da9efee: 8296935: Arrays.asList() can return a List that throws undocumented ArrayStoreException
  • 05af487: 8306681: Open source more AWT DnD related tests
  • ec5c792: 8306133: Open source few AWT Drag & Drop related tests
  • 6d6f726: 8307078: Opensource and clean up five more AWT Focus related tests
  • 89711f3: 8307079: Update test java/awt/Choice/DragOffNoSelect.java
  • 9ff5550: 8307077: Convert CRLF to LF in java.xml.crypto
  • ... and 479 more: https://git.openjdk.org/jdk/compare/6fa25cc134e8a6787490e080fb98c2d61cf0b049...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 29, 2023
@openjdk openjdk bot closed this Apr 29, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Apr 29, 2023
@openjdk
Copy link

openjdk bot commented Apr 29, 2023

@TheShermanTanker @SirYwell Pushed as commit a2d3fc8.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

7 participants