From 1082731179de306e3d5f0324ca9cc408f39816c0 Mon Sep 17 00:00:00 2001 From: "Gerlach, Winfried" Date: Tue, 31 Mar 2026 21:49:30 +0200 Subject: [PATCH 1/3] fix: ArrayDecoders can run into ArrayIndexOutOfBoundsException when start != 0 --- .../org/codehaus/stax2/ri/typed/ValueDecoderFactory.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/codehaus/stax2/ri/typed/ValueDecoderFactory.java b/src/main/java/org/codehaus/stax2/ri/typed/ValueDecoderFactory.java index 3f483ce..b5cf167 100644 --- a/src/main/java/org/codehaus/stax2/ri/typed/ValueDecoderFactory.java +++ b/src/main/java/org/codehaus/stax2/ri/typed/ValueDecoderFactory.java @@ -1255,7 +1255,7 @@ public void expand() int oldLen = old.length; int newSize = calcNewSize(oldLen); mResult = new int[newSize]; - System.arraycopy(old, mStart, mResult, 0, oldLen); + System.arraycopy(old, mStart, mResult, 0, mCount); mStart = 0; mEnd = newSize; } @@ -1315,7 +1315,7 @@ public void expand() int oldLen = old.length; int newSize = calcNewSize(oldLen); mResult = new long[newSize]; - System.arraycopy(old, mStart, mResult, 0, oldLen); + System.arraycopy(old, mStart, mResult, 0, mCount); mStart = 0; mEnd = newSize; } @@ -1373,7 +1373,7 @@ public void expand() int oldLen = old.length; int newSize = calcNewSize(oldLen); mResult = new float[newSize]; - System.arraycopy(old, mStart, mResult, 0, oldLen); + System.arraycopy(old, mStart, mResult, 0, mCount); mStart = 0; mEnd = newSize; } @@ -1431,7 +1431,7 @@ public void expand() int oldLen = old.length; int newSize = calcNewSize(oldLen); mResult = new double[newSize]; - System.arraycopy(old, mStart, mResult, 0, oldLen); + System.arraycopy(old, mStart, mResult, 0, mCount); mStart = 0; mEnd = newSize; } From 6e4752df2977936121b80b5b2e620ee9ef1a3aed Mon Sep 17 00:00:00 2001 From: "Gerlach, Winfried" Date: Tue, 31 Mar 2026 21:52:55 +0200 Subject: [PATCH 2/3] fix indentation --- .../java/org/codehaus/stax2/ri/typed/ValueDecoderFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/codehaus/stax2/ri/typed/ValueDecoderFactory.java b/src/main/java/org/codehaus/stax2/ri/typed/ValueDecoderFactory.java index b5cf167..7054ae7 100644 --- a/src/main/java/org/codehaus/stax2/ri/typed/ValueDecoderFactory.java +++ b/src/main/java/org/codehaus/stax2/ri/typed/ValueDecoderFactory.java @@ -428,7 +428,7 @@ protected static final int parseInt(int num, String digitChars, int start, int e num = (num * 10) + (digitChars.charAt(start) - '0'); } } - } + } } } } From 84b2fc8a892575530a7856df6c3fd637b815066c Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 31 Mar 2026 13:02:31 -0700 Subject: [PATCH 3/3] Update release notes --- release-notes/VERSION | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release-notes/VERSION b/release-notes/VERSION index a2fbd43..a2632e2 100644 --- a/release-notes/VERSION +++ b/release-notes/VERSION @@ -14,6 +14,8 @@ Not yet released (contributed by @winfriedgerlach) #29: Cleanup: reorder modifiers to comply with JLS; remove redundant casts (contributed by @winfriedgerlach) +#33: `ArrayDecoders` can run into `ArrayIndexOutOfBoundsException` when start != 0 + (contributed by @winfriedgerlach) - Use Maven wrapper for builds - Update parent (oss-parent) 55->68