Skip to content

Bound check in the instruction memory.init #7779

@erxiaozhou

Description

@erxiaozhou

Test Case

memory_init_0_9_0.zip

Steps to Reproduce

/home/zph/CP912/wasmtime/install/bin/wasmtime run <path_of_the__test_case> --invoke to_test

Expected Results

No exception

Actual Results

An exception indicating "Memory OOB"

Error: failed to run main module `<path_to_the_test_case>`

Caused by:
    0: failed to invoke `to_test`
    1: error while executing at wasm backtrace:
           0:  0x13f - <unknown>!<wasm function 0>
    2: wasm trap: out of bounds memory access

Versions and Environment

Wasmtime version or commit: 37300d3

Operating system: ubuntu 20.04

Architecture: x86_64

Extra Info

According to the specification, there should not be an exception, because here s+n=9, is not larger than the length of data.data and d+n=0, is smaller than the length of mem.data .

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions