Skip to content

Missing bounds check in code generated by AOT #1371

@lei-april

Description

@lei-april

The following wasm module:

(module
  (func (result i32)
    (i32.load (i32.const 0))
  )
  (memory 0)
)

when compiled by wamrc (version f3f8d68) with option --bounds-checks=1, produces the following machine code:

0000000000000000 <aot_func#0>:
   0:	48 8b 47 10          	mov    0x10(%rdi),%rax
   4:	48 8b 80 58 01 00 00 	mov    0x158(%rax),%rax
   b:	8b 00                	mov    (%rax),%eax
   d:	c3                   	retq

Apparently, there lacks bounds check in the generated code. If iwasm is built with hardware bound check disabled, running this wasm module would probably crash.

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