This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 071d42f2c65ba0efcfad9148b972f722da10f387 Author: Martin Desruisseaux <[email protected]> AuthorDate: Thu Aug 1 18:23:02 2024 +0200 Fix an IndexOutOfBoundsException in `SpecializableTransform`. --- .../referencing/operation/transform/SpecializableTransform.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/SpecializableTransform.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/SpecializableTransform.java index 1d533e253c..6472b6f193 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/SpecializableTransform.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/SpecializableTransform.java @@ -592,9 +592,12 @@ class SpecializableTransform extends AbstractMathTransform implements Serializab if (dstPts == null) { dstPts = new double[dstInc]; // Needed for checking if inside a sub-area. dstOff = 0; - } else if (srcPts == dstPts && srcOff + srcInc > dstOff && srcOff < dstOff + dstInc) { - srcPts = Arrays.copyOfRange(srcPts, srcOff, srcInc); - srcOff = 0; + } else if (srcPts == dstPts) { + final int srcEnd = srcOff + srcInc; + if (srcEnd > dstOff && srcOff < dstOff + dstInc) { + srcPts = Arrays.copyOfRange(srcPts, srcOff, srcEnd); + srcOff = 0; + } } /* * Above 'srcPts' dhould keep the source coordinates unchanged even if the source and destination
