RFR: 8274939: Incorrect size of the pixel storage is used by the robot on macOS

Sergey Bylokhov serb at openjdk.java.net
Fri Jan 28 05:18:11 UTC 2022


On Fri, 28 Jan 2022 04:03:00 GMT, Phil Race <prr at openjdk.org> wrote:

>A pointer to the destination in memory where the drawing is to be rendered. The size of this memory block should be at least (bytesPerRow*height) bytes. and picWidth * sizeof(jint), is bytes per row.
So if it the Java array pixels is just one int (4 bytes) and we have a scale of 2 when it needs to be 4 ints (16 bytes) we'd have the over-run ? 

If the scale is 2 then we will need 4 ints overall, but only 2 ints per row, since we will have 2 rows.

>Then why can't we just make sure (*env)->GetArrayLength(env, pixels) >= picWidth * picHeight ??

We can for sure, I can update the fix.

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

PR: https://git.openjdk.java.net/jdk/pull/5864



More information about the client-libs-dev mailing list