Skip to content

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

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs [email protected] csr Pull request needs approved CSR before integration rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants