diwakergupta / stacks-blockchain-tob-audit

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

Defining the same variable twice results in a panic #12

Open smoelius opened 4 years ago

smoelius commented 4 years ago

The panic occurs in ClarityDatabase::insert_metadata here: https://github.com/trailofbits/x-audit-blockstack-core/blob/e2d3d5bae539d242851620e28129af6c4a9de642/src/vm/database/clarity_db.rs#L191 The following test case witnesses the panic:

#[test]
fn double_define() {
    let program = "
        (define-data-var cursor int 0)
        (define-data-var cursor int 0)
    ";
    println!("{:?}", execute(&program));
}

Recommend that ClarityDatabase::insert_metadata return an error instead.