On Thu, 15 Jan 2026 19:50:47 GMT, Phil Race <[email protected]> wrote:

> Some of the medialib native functions implementing Convolve read data from 
> arrays when it is not needed or used instead of reading just what is needed 
> and used.
> This is detected as a read out of bounds. It is limited and hasn't been seen 
> to result in any crashes without ASAN, and the OOB values that are read are 
> never used so there's a very limited problem.
> The changes here make the mlib_ImageConv_*nw.c files match what happens in 
> the mlib_ImageConv_*ext.c files which read just the data they need.
> The changes are fairly mechanical but there could be copy/paste errors for a 
> reviewer to find.
> 
> Not easy to provide a test case, building with --enable-asan is needed and 
> for me it works only on macOS.
> I did that and ran all our existing automated tests on our CI systems.

src/java.desktop/share/native/libmlib_image/mlib_c_ImageConvVersion.c line 54:

> 52:                                mlib_type type)
> 53: {
> 54:   mlib_d64 dscale = 1.0 / (((mlib_s64)1) << scale); /* 16 < scale <= 31 */

This isn't the same as the rest of the changes but when looking at code paths I 
saw this fn called with a scale of 31. But (1 << 31) is negative. I don't think 
that was intended here ! So by making this a 64 bit int we avoid that.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29257#discussion_r2695745435

Reply via email to