Skip to content

Assertion `local_ref_is_set_.size() == label->local_ref_is_set_.size()' failed at wasm-interp #2670

@Q1IQ

Description

@Q1IQ

Current State

Run the following command:

wasm-interp --enable-all --run-export=main test.wasm

test.wasm.txt

Observed output:

wasm-interp: /work/harnesses/sources/wabt/src/shared-validator.cc:512: void wabt::SharedValidator::RestoreLocalRefs(wabt::Result): Assertion `local_ref_is_set_.size() == label->local_ref_is_set_.size()' failed.

GDB Backtrace

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=..., signo=..., threadid=...) at ./nptl/pthread_kill.c:44
#0  __pthread_kill_implementation (no_tid=..., signo=..., threadid=...) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=..., threadid=...) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=..., signo=...) at ./nptl/pthread_kill.c:89
#3  0x00007ffff6c26476 in __GI_raise (sig=...) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff6c0c7f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff6c0c71b in __assert_fail_base (fmt=..., assertion=..., file=..., line=..., function=...) at ./assert/assert.c:94
#6  0x00007ffff6c1de96 in __GI___assert_fail (assertion=..., file=..., line=..., function=...) at ./assert/assert.c:103
#7  0x0000555555766433 in wabt::SharedValidator::RestoreLocalRefs (this=..., result=...) at /work/harnesses/sources/wabt/src/shared-validator.cc:512
#8  0x000055555577366e in wabt::SharedValidator::OnEnd (this=..., loc=...) at /work/harnesses/sources/wabt/src/shared-validator.cc:917
#9  0x00005555555df32e in wabt::interp::(anonymous namespace)::BinaryReaderInterp::OnEndExpr (this=...) at /work/harnesses/sources/wabt/src/interp/binary-reader-interp.cc:358
#10 0x00005555556f0f21 in wabt::(anonymous namespace)::BinaryReader::ReadInstructions (this=..., end_offset=..., context=...) at /work/harnesses/sources/wabt/src/binary-reader.cc:881
#11 0x000055555570860e in wabt::(anonymous namespace)::BinaryReader::ReadFunctionBody (end_offset=..., this=...) at /work/harnesses/sources/wabt/src/binary-reader.cc:737
#12 wabt::(anonymous namespace)::BinaryReader::ReadCodeSection (section_size=..., this=...) at /work/harnesses/sources/wabt/src/binary-reader.cc:2935
#13 wabt::(anonymous namespace)::BinaryReader::ReadSections (options=..., this=...) at /work/harnesses/sources/wabt/src/binary-reader.cc:3088
#14 wabt::(anonymous namespace)::BinaryReader::ReadModule (options=..., this=...) at /work/harnesses/sources/wabt/src/binary-reader.cc:3162
#15 wabt::ReadBinary (data=..., size=..., delegate=..., options=...) at /work/harnesses/sources/wabt/src/binary-reader.cc:3184
#16 0x00005555555f78dc in wabt::interp::ReadBinaryInterp (filename=..., data=..., size=..., options=..., errors=..., out_module=...) at /work/harnesses/sources/wabt/src/interp/binary-reader-interp.cc:1751
#17 0x00005555555a42db in ReadModule (out_module=..., errors=..., module_filename=...) at /work/harnesses/sources/wabt/src/tools/wasm-interp.cc:324
#18 ReadAndRunModule (module_filename=...) at /work/harnesses/sources/wabt/src/tools/wasm-interp.cc:351
#19 ProgramMain (argc=..., argv=...) at /work/harnesses/sources/wabt/src/tools/wasm-interp.cc:450
rax            0x0                 0
rbx            0x7ffff6bdf7c0      140737333032896
rcx            0x7ffff6c7a9fc      140737333668348
rdx            0x6                 6
rsi            0x2ad7c             175484
rdi            0x2ad7c             175484
rbp            0x2ad7c             0x2ad7c
rsp            0x7fffffff9a70      0x7fffffff9a70
r8             0x7fffffff9b40      140737488329536
r9             0x0                 0
r10            0x8                 8
r11            0x246               582
r12            0x6                 6
r13            0x16                22
r14            0x555555823280      93824995177088
r15            0x0                 0
rip            0x7ffff6c7a9fc      0x7ffff6c7a9fc <__GI___pthread_kill+300>
eflags         0x246               [ PF ZF IF ]
cs             0x33                51
ss             0x2b                43
ds             0x0                 0
es             0x0                 0
fs             0x0                 0
gs             0x0                 0
A debugging session is active.

	Inferior 1 [process 175484] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]
warning: Error disabling address space randomization: Operation not permitted
wasm-interp: /work/harnesses/sources/wabt/src/shared-validator.cc:512: void wabt::SharedValidator::RestoreLocalRefs(wabt::Result): Assertion `local_ref_is_set_.size() == label->local_ref_is_set_.size()' failed.
44	./nptl/pthread_kill.c: No such file or directory.

Reproduction steps

  1. Save the attached test file: test.wasm
  2. Run the command:
wasm-interp --enable-all --run-export=main test.wasm
  1. Observe the crash/error

WABT Version or Commit you used

Commit: ee87962
Version: 1.0.39 (git~1.0.39-3-gee879620)

Operating system information

Ubuntu 20.04

Hardware Architecture

amd64 (x86_64)

Metadata

Metadata

Assignees

No one assigned

    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