From 6e6a39d35fda929300c7668fdf5d2f0fbfed0606 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Mon, 24 Mar 2025 19:52:52 +0000 Subject: [PATCH] 8347321: [ubsan] CGGlyphImages.m:553:30: runtime error: nan is outside the range of representable values of type 'unsigned long' Reviewed-by: kizune, azvegint, aivanov --- .../macosx/classes/sun/font/CStrike.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/java.desktop/macosx/classes/sun/font/CStrike.java b/src/java.desktop/macosx/classes/sun/font/CStrike.java index 323c6e86a72..cfab6a9f4c3 100644 --- a/src/java.desktop/macosx/classes/sun/font/CStrike.java +++ b/src/java.desktop/macosx/classes/sun/font/CStrike.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -102,6 +102,17 @@ public final class CStrike extends PhysicalStrike { final double[] glyphTx = new double[6]; desc.glyphTx.getMatrix(glyphTx); + for (int i = 0; i < 6; i++) { + if (Double.isFinite(glyphTx[i])) { + continue; + } + for (int j = 0; j < 6; j++) { + glyphTx[j] = 0; + } + invDevTx = null; + break; + } + final double[] invDevTxMatrix = new double[6]; if (invDevTx == null) { invDevTxMatrix[0] = 1;