diwakergupta / stacks-blockchain-tob-audit

GNU General Public License v3.0
0 stars 0 forks source link

Panic in `TypeSignature::admits_type` #17

Open smoelius opened 4 years ago

smoelius commented 4 years ago

The panic occurs here: https://github.com/trailofbits/x-audit-blockstack-core/blob/e2d3d5bae539d242851620e28129af6c4a9de642/src/vm/types/signatures.rs#L274 The panic can be witnessed by changing the following test: https://github.com/trailofbits/x-audit-blockstack-core/blob/e2d3d5bae539d242851620e28129af6c4a9de642/src/vm/analysis/type_checker/tests/mod.rs#L584 to:

 "(append (list) 4)", 

In that case, the type

ListType(ListTypeData { max_len: 0, entry_type: NoType })

is inferred for the append's (list) argument.

Then, at this line in check_special_append, NoType is asked whether it admits IntType: https://github.com/trailofbits/x-audit-blockstack-core/blob/e2d3d5bae539d242851620e28129af6c4a9de642/src/vm/analysis/type_checker/natives/iterables.rs#L160 Hence, the panic.