Skip to content

EH: operand stack overrun #3131

Open
Open
@yamt

Description

@yamt

when crossing function frames, the current throw logic copies the exception onto the operand stack.
if the frame doesn't have enough stack space, it overruns.
a possible fix: rewind function frames in the throw logic rather than using goto return_func.

eg.

(module
  (tag $e (param i32 i32 i32 i32 i32 i32 i32 i32))
  (func $g
    i32.const 1234
    i32.const 1234
    i32.const 1234
    i32.const 1234
    i32.const 1234
    i32.const 1234
    i32.const 1234
    i32.const 1234
    throw $e
  )
  (func $f ;; the throw logic would overrun when copying the exception to this frame
    call $g
  )
  (func (export "main")
    try
      call $f
    catch_all
    end
  )
)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions