Skip to content

Commit

Permalink
FIX: Crash when loading specially crafted binary
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Oct 31, 2020
1 parent 6121a84 commit bdaca6a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/s-crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ static REBCNT *CRC32_Table = 0;

for (; ulen > 0; str++, ulen--) {
n = *str;
if (n > 127 && NZ(m = Decode_UTF8_Char(&str, &ulen))) n = m; // mods str, ulen
if (n > 127) {
m = Decode_UTF8_Char(&str, &ulen); // mods str, ulen
if (!m) Trap0(RE_INVALID_CHARS);
n = m;
}
if (n < UNICODE_CASES) n = LO_CASE(n);
n = (REBYTE)((hash >> CRCSHIFTS) ^ (REBYTE)n); // drop upper 8 bits
hash = MASK_CRC(hash << 8) ^ (REBINT)CRC24_Table[n];
Expand Down

0 comments on commit bdaca6a

Please sign in to comment.