Skip to content

Commit d30f29a

Browse files
AdamAdam
authored andcommitted
oss-fuzz-451112368: fix found crash
Signed-off-by: Adam <adam@Adam-Workstation.lan>
1 parent 629a363 commit d30f29a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Parser/tokenizer/helpers.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,8 @@ valid_utf8(const unsigned char* s)
494494
return 0;
495495
}
496496
length = expected + 1;
497-
for (; expected; expected--)
498-
if (s[expected] < 0x80 || s[expected] >= 0xC0)
497+
for (int i = 1; i <= expected; i++)
498+
if (s[i] < 0x80 || s[i] >= 0xC0)
499499
return 0;
500500
return length;
501501
}

0 commit comments

Comments
 (0)