Skip to content

Commit 9181665

Browse files
committed
Fixed a bug when parsing unterminated strings in json
1 parent aa4f780 commit 9181665

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

choc/text/choc_JSON.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ inline value::Value parse (text::UTF8Pointer text, bool parseBareValue)
460460

461461
for (;;)
462462
{
463+
auto charStart = current;
463464
auto c = pop();
464465

465466
if (c == '"')
@@ -484,6 +485,9 @@ inline value::Value parse (text::UTF8Pointer text, bool parseBareValue)
484485
}
485486
}
486487

488+
if (c == 0)
489+
throwError ("Unexpected EOF in string constant", charStart);
490+
487491
char utf8Bytes[8];
488492
auto numBytes = text::convertUnicodeCodepointToUTF8 (utf8Bytes, c);
489493

0 commit comments

Comments
 (0)