> convolveBI() and convolveRaster() entry points read kern[klen - 1] without 
> requiring a nonempty kernel array.
> 
> In JDK 25 and earlier, new Kernel(0, 0, new float[0]) is accepted by the 
> constructor. If this reaches the native convolution code, kern[klen - 1] 
> becomes kern[-1], an out-of-bounds read.
> 
> JDK 26 added dimension validation to the Kernel constructor (JDK-8368729), 
> but the native methods still read the dimensions and coefficient array 
> directly from the object's fields. Inconsistent values can also be supplied 
> through reflection.
> 
> Both methods should reject invalid kernel dimensions and array lengths before 
> accessing the coefficients.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Timofei Fedotov has updated the pull request incrementally with two additional 
commits since the last revision:

 - Replace reflection-based test with public API test
 - Pass Kernel data to JNI instead of accessing private fields

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/33887/files
  - new: https://git.openjdk.org/jdk/pull/33887/files/0115a294..263d8430

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=33887&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=33887&range=00-01

  Stats: 229 lines in 4 files changed: 104 ins; 106 del; 19 mod
  Patch: https://git.openjdk.org/jdk/pull/33887.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/33887/head:pull/33887

PR: https://git.openjdk.org/jdk/pull/33887

Reply via email to