File tree Expand file tree Collapse file tree 3 files changed +1668
-0
lines changed
java/com/github/underscore Expand file tree Collapse file tree 3 files changed +1668
-0
lines changed Original file line number Diff line number Diff line change 3232
3333import com .github .underscore .Json .JsonStringBuilder ;
3434import com .github .underscore .Xml .XmlStringBuilder ;
35+
36+ import java .io .IOException ;
37+ import java .nio .file .Files ;
38+ import java .nio .file .Paths ;
3539import java .util .ArrayList ;
3640import java .util .Arrays ;
3741import java .util .Collection ;
@@ -3424,6 +3428,26 @@ void fromJsonMap() {
34243428 assertEquals ("{}" , U .fromJsonMap (stringJson2 ).toString ());
34253429 }
34263430
3431+ @ Test
3432+ void fromJsonStackoverflowObject () throws IOException {
3433+ String stringJson = new String (Files .readAllBytes (Paths .get ("src/test/resources/wellFormedObject.json" )));
3434+ try {
3435+ U .fromJsonMap (stringJson );
3436+ } catch (Throwable throwable ) {
3437+ assertTrue (throwable instanceof StackOverflowError );
3438+ }
3439+ }
3440+
3441+ @ Test
3442+ void fromJsonStackoverflowArray () throws IOException {
3443+ String stringJson = new String (Files .readAllBytes (Paths .get ("src/test/resources/wellFormedArray.json" )));
3444+ try {
3445+ U .fromJsonMap (stringJson );
3446+ } catch (Throwable throwable ) {
3447+ assertTrue (throwable instanceof StackOverflowError );
3448+ }
3449+ }
3450+
34273451 @ Test
34283452 void testDecodeParseXmlErr13 () {
34293453 assertThrows (IllegalArgumentException .class , () -> U .fromXml ("[\" abc\u0010 \" ]" ));
You can’t perform that action at this time.
0 commit comments