RFR: 8333277: ubsan: mlib_ImageScanPoly.c:292:43: runtime error: division by zero

Matthias Baesken mbaesken at openjdk.org
Wed Jun 12 08:08:53 UTC 2024


When running the jdk jtreg tests with ubsan enabled binaries on Linux x86_64, I get the warning below.
This shows up in a couple of tests, for example
java/awt/image/mlib/MlibOpsTest.jtr
java/awt/image/Raster/TestChildRasterOp.jtr

src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c:292:43: runtime error: division by zero
    #0 0x7fe6d958b862 in mlib_AffineEdges src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c:292
    #1 0x7fe6d958bb5d in mlib_ImageAffine_alltypes src/java.desktop/share/native/libmlib_image/mlib_ImageAffine.c:179
    #2 0x7fe6d9e9b398 in Java_sun_awt_image_ImagingLib_transformBI src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c:922
    #3 0x7fe76f00ae7b (<unknown module>)

The issue has been discussed with Phil Race (see https://bugs.openjdk.org/browse/JDK-8333277) and the division by zero has been already handled in the coding.
However we can avoid it  (and make ubsan happy) and in this case also do a few operations less.

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

Commit messages:
 - JDK-8333277

Changes: https://git.openjdk.org/jdk/pull/19674/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19674&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8333277
  Stats: 7 lines in 1 file changed: 4 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/19674.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19674/head:pull/19674

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


More information about the client-libs-dev mailing list