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:
Matthew Flatt 2014-06-23 13:23:47 +01:00
parent 431321f2cb
commit 6a5a3037b4

View File

@ -611,11 +611,11 @@ const char *scheme_symbol_name_and_size(Scheme_Object *sym, uintptr_t *length, i
if (ch > 127) {
/* Decode UTF-8. */
mzchar buf[2];
int ul = 2;
int ul = 1;
while (1) {
if (scheme_utf8_decode((unsigned char *)s, i, i + ul,
buf, 0, 1,
NULL, 0, 0) > 0)
NULL, 0, '?') > 0)
break;
ul++;
}