Skip to content

MemoryPacking can result in dangling data.drops #2535

Closed

Description

@aheejin

After #2529, it was discovered that MemoryPacking pass does not properly delete or fix data.drop instructions (and possibly other instructions like memory.init) that refer to deleted segments. Given that #2426 is coming I'm not sure if it's worth fixing per se, but I'll file a bug report here to track this thing.

Test case:
Running
wasm-opt -all --memory-packing t.wast

t.wast:

(module
 (memory 1 1)
 (data (i32.const 0) "")
 (func $bar
  (drop
   (loop (result i32)
    (data.drop 0)
    (i32.const 42)
   )
  )
 )
)

results in a validation error saying [wasm-validator error in function bar] unexpected false: data.drop segment index out of bounds, on, ...

cc @tlively

Activity

  1. self-assigned this
    on Dec 17, 2019
  2. added 2 commits that reference this issue on Dec 19, 2019
    78e4eb8
    017205d
  3. aheejin commented on Dec 19, 2019

    @aheejin
    MemberAuthor

    Fixed this in #2540; this is gonna eventually be fixed by #2426 but this keeps coming up in the fuzzer, so.

  4. added a commit that references this issue on Dec 19, 2019
    0048f5b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions