You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/09/22 14:04:29 UTC
(commons-text) branch master updated: Add test for OSS-Fuzz issue 42522985
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git
The following commit(s) were added to refs/heads/master by this push:
new d4db7989 Add test for OSS-Fuzz issue 42522985
d4db7989 is described below
commit d4db798927a0660dade53508bc99c6431a19afad
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Sep 22 10:04:22 2024 -0400
Add test for OSS-Fuzz issue 42522985
- apache-commons-text:StringSubstitutorInterpolatorFuzzer: Security
exception in java.base/java.util.Arrays.copyOf
- https://issues.oss-fuzz.com/issues/42522985
---
.../commons/text/StringSubstitutorOssFuzzTest.java | 21 ++++++++++++++++++++-
...gSubstitutorInterpolatorFuzzer-5149898315268096 | Bin 0 -> 570892 bytes
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorOssFuzzTest.java b/src/test/java/org/apache/commons/text/StringSubstitutorOssFuzzTest.java
index 19f52573..add065b2 100644
--- a/src/test/java/org/apache/commons/text/StringSubstitutorOssFuzzTest.java
+++ b/src/test/java/org/apache/commons/text/StringSubstitutorOssFuzzTest.java
@@ -17,12 +17,31 @@
package org.apache.commons.text;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
import org.junit.jupiter.api.Test;
public class StringSubstitutorOssFuzzTest {
/**
- * Tests OSS-Fuzz issue 42527553
+ * Tests OSS-Fuzz issue 42522985.
+ *
+ * apache-commons-text:StringSubstitutorInterpolatorFuzzer: Security exception in java.base/java.util.Arrays.copyOf
+ *
+ * https://issues.oss-fuzz.com/issues/42522985
+ */
+ @Test
+ public void test() throws IOException {
+ final byte[] allBytes = Files.readAllBytes(
+ Paths.get("src/test/resources/org/apache/commons/text/oss-fuzz/clusterfuzz-testcase-StringSubstitutorInterpolatorFuzzer-5149898315268096"));
+ StringSubstitutor.createInterpolator().replace(new String(allBytes, StandardCharsets.UTF_8));
+ }
+
+ /**
+ * Tests OSS-Fuzz issue 42527553.
*
* apache-commons-text:StringSubstitutorInterpolatorFuzzer: Security exception in java.base/java.util.Arrays.copyOf
*
diff --git a/src/test/resources/org/apache/commons/text/oss-fuzz/clusterfuzz-testcase-StringSubstitutorInterpolatorFuzzer-5149898315268096 b/src/test/resources/org/apache/commons/text/oss-fuzz/clusterfuzz-testcase-StringSubstitutorInterpolatorFuzzer-5149898315268096
new file mode 100644
index 00000000..329df2b7
Binary files /dev/null and b/src/test/resources/org/apache/commons/text/oss-fuzz/clusterfuzz-testcase-StringSubstitutorInterpolatorFuzzer-5149898315268096 differ