avoid getting stuck on non-UTF-8 symbol encodings in bytecode
Found by fuzz tester, and this bug seems to be a common reason for the fuzz test to time out.
This commit is contained in:
parent
431321f2cb
commit
6a5a3037b4
|
@ -611,11 +611,11 @@ const char *scheme_symbol_name_and_size(Scheme_Object *sym, uintptr_t *length, i
|
||||||
if (ch > 127) {
|
if (ch > 127) {
|
||||||
/* Decode UTF-8. */
|
/* Decode UTF-8. */
|
||||||
mzchar buf[2];
|
mzchar buf[2];
|
||||||
int ul = 2;
|
int ul = 1;
|
||||||
while (1) {
|
while (1) {
|
||||||
if (scheme_utf8_decode((unsigned char *)s, i, i + ul,
|
if (scheme_utf8_decode((unsigned char *)s, i, i + ul,
|
||||||
buf, 0, 1,
|
buf, 0, 1,
|
||||||
NULL, 0, 0) > 0)
|
NULL, 0, '?') > 0)
|
||||||
break;
|
break;
|
||||||
ul++;
|
ul++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user