Skip to content

Commit 67e5988

Browse files
author
John J. Aylward
committed
add second case for data in #484
1 parent 3e7a0b1 commit 67e5988

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/test/java/org/json/junit/JSONMLTest.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import static org.junit.Assert.*;
44

5+
import java.util.Base64;
6+
57
import org.json.*;
68
import org.junit.Test;
79

@@ -805,7 +807,7 @@ public void testToJSONObject_reversibility() {
805807
// }
806808

807809
@Test (timeout = 6000)
808-
public void testIssue484InfinteLoop() {
810+
public void testIssue484InfinteLoop1() {
809811
try {
810812
JSONML.toJSONObject("??*^M??|?CglR^F??`??>?w??PIlr^E??D^X^]?$?-^R?o??O?*??{OD?^FY??`2a????NM?b^Tq?:O?>S$^K?J?^FB.gUK?m^H??zE??^??!v]?^A???^[^A??^U?c??????h???s???g^Z???`?q^Dbi??:^QZl?)?}1^??k?0??:$V?$?Ovs(}J??^V????2;^QgQ?^_^A?^D?^U?Tg?K?`?h%c?hmGA?<!C*^P^Y?^X9?~?t?)??,z^XA???S}?Q??.q?j????]");
811813
fail("Exception expected for invalid JSON.");
@@ -815,4 +817,18 @@ public void testIssue484InfinteLoop() {
815817
ex.getMessage());
816818
}
817819
}
820+
821+
@Test (timeout = 6000)
822+
public void testIssue484InfinteLoop2() {
823+
try {
824+
String input = "??*\n" +
825+
"??|?CglR??`??>?w??PIlr??D?$?-?o??O?*??{OD?Y??`2a????NM?bq?:O?>S$ ?J?B.gUK?m\b??zE???!v]???????c??????h???s???g???`?qbi??:Zl?)?}1^??k?0??:$V?$?Ovs(}J??????2;gQ????Tg?K?`?h%c?hmGA?<!C*?9?~?t?)??,zA???S}?Q??.q?j????]";
826+
JSONML.toJSONObject(input);
827+
fail("Exception expected for invalid JSON.");
828+
} catch (JSONException ex) {
829+
assertEquals("Exception string did not match: ",
830+
"Unterminated string at 242 [character 238 line 2]",
831+
ex.getMessage());
832+
}
833+
}
818834
}

0 commit comments

Comments
 (0)