Skip to content

[Bug] Paranoid mode does not check if references are being captured when packing a closure #17156

@vineethk

Description

@vineethk

🐛 Bug

Consider the following masm transactional test:

//# publish --verbose
module 0xc0ffee::m

public fun f(): ||u64
    local x: u64
    ld_u64 0
    st_loc x
    borrow_loc x
    // we are capturing a reference
    pack_closure g, 1
    ret

public fun g(x: &u64): u64
    move_loc x
    read_ref
    ret

public fun h(): u64
    call f
    call_closure<|&u64|u64>
    ret

//# run --verbose
script
use 0xc0ffee::m

fun main()
    call m::h
    pop
    ret

If we turn off the static bytecode verifier, then the paranoid mode does not check that references are captured when packing a closure. Instead, we get an invariant violation error in type layout converter.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmove-vm

Type

Projects

Status

🆕 New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions