From 40f150d3e50caf44fa4a31b79fbcd234142803ce Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Thu, 6 Mar 2025 08:10:23 +0000 Subject: [PATCH] 8330936: [ubsan] exclude function BilinearInterp and ShapeSINextSpan in libawt java2d from ubsan checks Reviewed-by: clanger, prr --- .../share/native/libawt/java2d/loops/TransformHelper.c | 5 ++++- .../share/native/libawt/java2d/pipe/ShapeSpanIterator.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/java.desktop/share/native/libawt/java2d/loops/TransformHelper.c b/src/java.desktop/share/native/libawt/java2d/loops/TransformHelper.c index 02c99ea9ada..cad849961d1 100644 --- a/src/java.desktop/share/native/libawt/java2d/loops/TransformHelper.c +++ b/src/java.desktop/share/native/libawt/java2d/loops/TransformHelper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,8 @@ #include "sun_java2d_loops_TransformHelper.h" #include "java_awt_image_AffineTransformOp.h" +#include "ub.h" + /* * The stub functions replace the bilinear and bicubic interpolation * functions with NOP versions so that the performance of the helper @@ -661,6 +663,7 @@ Transform_SafeHelper(JNIEnv *env, ((jubyte *)pRes)[comp] = (jubyte) ((cR + (1<<15)) >> 16); \ } while (0) +ATTRIBUTE_NO_UBSAN static void BilinearInterp(jint *pRGB, jint numpix, jint xfract, jint dxfract, diff --git a/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c b/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c index 4f973a7037d..5b34ac9fbaa 100644 --- a/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c +++ b/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,8 @@ #include "sun_java2d_pipe_ShapeSpanIterator.h" #include "java_awt_geom_PathIterator.h" +#include "ub.h" + /* * This structure holds all of the information needed to trace and * manage a single line segment of the shape's outline. @@ -1233,6 +1235,7 @@ ShapeSIIntersectClipBox(JNIEnv *env, void *private, } } +ATTRIBUTE_NO_UBSAN static jboolean ShapeSINextSpan(void *state, jint spanbox[]) {