Skip to content

Commit 62ca604

Browse files
committed
Merge pull request #28 from ZECTBynmo/master
Fix infinite loop for characters above 244
2 parents c265d37 + e7beada commit 62ca604

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

jsonparse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ proto.write = function (buffer) {
131131
this.bytes_in_sequence = this.bytes_remaining = 0;
132132
i = i + j - 1;
133133
} else if (this.bytes_remaining === 0 && n >= 128) { // else if no remainder bytes carried over, parse multi byte (>=128) chars one at a time
134-
if (n <= 193) {
134+
if (n <= 193 || n > 244) {
135135
return this.onError(new Error("Invalid UTF-8 character at position " + i + " in state " + Parser.toknam(this.tState)));
136136
}
137137
if ((n >= 194) && (n <= 223)) this.bytes_in_sequence = 2;

0 commit comments

Comments
 (0)