Skip to content

Commit e7beada

Browse files
committed
Fix infinite loop for characters above 244
1 parent c265d37 commit e7beada

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)