RFR: 8299748: java/util/zip/Deinflate.java failing on s390x [v2]

Amit Kumar duke at openjdk.org
Tue Feb 7 11:14:46 UTC 2023


On Thu, 2 Feb 2023 08:27:55 GMT, Amit Kumar <duke at openjdk.org> wrote:

>> DeInflate.java test fails on s390x platform because size for out1 array which is responsible for storing the compressed data is insufficient. And being unable to write whole compressed data on array, on s390 whole data can't be recovered after compression. So this fix increase Array size (for s390).
>
> Amit Kumar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   change acc to Alan comments

Alan, with these changes I've pasted the output below:

diff --git a/test/jdk/java/util/zip/DeInflate.java b/test/jdk/java/util/zip/DeInflate.java
index 9ad0aa5d250..eaf1fb2ba45 100644
--- a/test/jdk/java/util/zip/DeInflate.java
+++ b/test/jdk/java/util/zip/DeInflate.java
@@ -131,9 +131,14 @@ public class DeInflate {
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream(len);
         while (!def.finished()) {
-            int temp_counter = def.deflate(out1);
-            m += temp_counter;
-            baos.write(out1, 0, temp_counter);
+            int remaining = out1.length - m;
+            int temp_value = def.deflate(out1, m, remaining);
+            System.out.println("compressed: " + temp_value); 
+            System.out.println("is finished: " + def.finished());
+//            if (remaining == 0) {
+//                throw new RuntimeException("out1 is small");
+//            }
+            m += temp_value;
         }
         out1 = baos.toByteArray();
         baos.reset();
@@ -142,9 +147,11 @@ public class DeInflate {
         int n = 0;
 
         while (!inf.finished()) {
-            int temp_counter = inf.inflate(out2);
-            n += temp_counter;
-            baos.write(out2, 0,  temp_counter);
+            int remaining = out2.length - n;
+            if (remaining == 0) {
+                throw new RuntimeException("out2 is small");
+            }
+            n += inf.inflate(out2, n, remaining);
         }


I'm getting this output:

level:-1, strategy: 0, dowrap: false
compressed: 524454
is finished: true
result: Failed. Execution failed: `main' threw exception: java.lang.ArrayIndexOutOfBoundsException: Range [524454, 524454 + 0) out of bounds for length 0

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

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


More information about the core-libs-dev mailing list