Affects Version/s: 1.14.4, 1.15 Pre-release 6, 1.16.1, 1.16.2, 21w06a
Fix Version/s: 21w18a
Mojang Priority:Very Important
Bounds checks in NativeImage are incorrect, and it uses UNSAFE to directly access memory, so misusing it can cause the JRE to completely crash instead of throwing an exception. As far as I am aware, this bug is not currently being triggered by any vanilla code that calls NativeImage.
NativeImage should check that x and y are both >= 0.
The checks for x <= width should be x < width
and the checks for y <= height should be y < height.
- NativeImage.getPixelRGBA(int, int)
- NativeImage.setPixelRGBA(int, int, int)
- NativeImage.getLuminanceOrAlpha(int, int)
Note: These methods do not check for negative x or y values either.