Skip to content

Conversation

liach
Copy link
Member

@liach liach commented Jul 8, 2025

In the class file format, a lot of the values are u1 or u2; the Class-File API consistently model them with int. However, the API does not, in general, validate that int values passed to the factory methods are not out of the bounds as defined in the class file format. This patch proposes to add such validation for factory methods accepting such more narrow data, prepared by examining all int-accepting methods in the Class-File API.

I expect this to have a small compatibility impact - besides the -1 for the minor version, there is no other places where most significant bits are ever meaningful, and I special cased it and consistently fail fast for all other OOB values, which always mean programmer errors.

A CSR will be created soon as well.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change requires CSR request JDK-8361637 to be approved
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issues

  • JDK-8361614: Missing sub-int value validation in the Class-File API (Bug - P4)
  • JDK-8361637: Missing sub-int value validation in the Class-File API (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26201

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 8, 2025

👋 Welcome back liach! 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 Jul 8, 2025

@liach 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:

8361614: Missing sub-int value validation in the Class-File API

Reviewed-by: asotona

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 4 new commits pushed to the master branch:

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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 8, 2025
@openjdk
Copy link

openjdk bot commented Jul 8, 2025

@liach 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.

@mlbridge
Copy link

mlbridge bot commented Jul 8, 2025

Webrevs

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Jul 8, 2025
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.

Nice summary fix of the validation.

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 15, 2025

@liach 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 issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@liach
Copy link
Member Author

liach commented Aug 15, 2025

/touch

@openjdk
Copy link

openjdk bot commented Aug 15, 2025

@liach The pull request is being re-evaluated and the inactivity timeout has been reset.

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Aug 29, 2025
@liach liach requested a review from asotona August 29, 2025 13:53
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 29, 2025
@liach
Copy link
Member Author

liach commented Aug 29, 2025

Thanks for the reviews!

/integrate

@openjdk
Copy link

openjdk bot commented Aug 29, 2025

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 29, 2025

@liach Pushed as commit ae96077.

💡 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 [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants