JDK-8341288 : Validate slot argument for instruction factories
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.lang.classfile
  • Priority: P4
  • Status: Draft
  • Resolution: Unresolved
  • Fix Versions: 24
  • Submitted: 2024-09-30
  • Updated: 2024-09-30
Related Reports
CSR :  
Description
Summary
-------

Validate the local variable slot argument, multinewarray dimensions argument, and iinc value arguments and specify such validation.

Problem
-------

Currently, local variable slot, multinewarray dimensions, and iinc value are all modeled by plain `int` values. They are not range-checked upon passing into factory methods. Therefore, the created model objects can have illegal values not representable in the `class` file format, or not allowed by the JVMS.

Solution
--------

Perform range checks on these 3 selected type of arguments and specify that range checks are performed. This is better than allowing such values to be lost in the writing of `class` files, or to be passed to downstream class file transformations.

Specification
-------------

See the attached diff.
Comments
Note to reviewers: This is independent of the Class-File API JEP; it only specifies some failure-case behavior change and does not affect the intended functionalities of the API.
30-09-2024