defend against bad hash type in bytecode

The change to make `#hash()`, etc., unique made it easy for the fuzz
tester to crash the bytecode reader.
This commit is contained in:
Matthew Flatt 2019-03-22 07:34:36 -06:00
parent 3501fce192
commit e34dbdc4f4

View File

@ -2738,10 +2738,12 @@ static Scheme_Object *read_compact(CPort *port, int use_stack)
Scheme_Object *k;
kind = read_compact_number(port);
if ((kind < 0) || (kind > 2))
scheme_ill_formed_code(port);
len = read_compact_number(port);
ht = scheme_make_hash_tree(kind);
while (len--) {
while (len--) {
k = read_compact(port, 0);
v = read_compact(port, 0);
ht = scheme_hash_tree_set(ht, k, v);