Documentation ¶
Overview ¶
Package validate provides functions for validating WebAssembly modules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrStackUnderflow = errors.New("validate: stack underflow")
ErrStackUnderflow is returned if an instruction consumes a value, but there are no values on the stack.
var PrintDebugInfo = false
Functions ¶
func VerifyModule ¶
VerifyModule verifies the given module according to WebAssembly verification specs.
Types ¶
type Error ¶
type Error struct { Offset int // Byte offset in the bytecode vector where the error occurs. Function int // Index into the function index space for the offending function. Err error }
Error wraps validation errors with information about where the error was encountered.
type InvalidImmediateError ¶
InvalidImmediateError is returned if the immediate value provided is invalid for the given instruction.
func (InvalidImmediateError) Error ¶
func (e InvalidImmediateError) Error() string
type InvalidLabelError ¶
type InvalidLabelError uint32
InvalidTypeError is returned if a branch is encountered which points to a block that does not exist.
func (InvalidLabelError) Error ¶
func (e InvalidLabelError) Error() string
type InvalidLocalIndexError ¶
type InvalidLocalIndexError uint32
InvalidLocalIndexError is returned if a local variable index is referenced which does not exist.
func (InvalidLocalIndexError) Error ¶
func (e InvalidLocalIndexError) Error() string
type InvalidTableIndexError ¶
type InvalidTableIndexError struct {
// contains filtered or unexported fields
}
InvalidTableIndexError is returned if a table is referenced with an out-of-bounds index.
func (InvalidTableIndexError) Error ¶
func (e InvalidTableIndexError) Error() string
type InvalidTypeError ¶
InvalidTypeError is returned if there is a mismatch between the type(s) an operator or function accepts, and the value provided.
func (InvalidTypeError) Error ¶
func (e InvalidTypeError) Error() string
type NoSectionError ¶
NoSectionError is returned if a section does not exist.
func (NoSectionError) Error ¶
func (e NoSectionError) Error() string
type UnbalancedStackErr ¶
UnbalancedStackErr is returned if there are too many items on the stack than is valid for the current block or function.
func (UnbalancedStackErr) Error ¶
func (e UnbalancedStackErr) Error() string
type UnmatchedIfValueErr ¶
UnmatchedIfValueErr is returned if an if block returns a value, but no else block is present.
func (UnmatchedIfValueErr) Error ¶
func (e UnmatchedIfValueErr) Error() string
type UnmatchedOpError ¶
type UnmatchedOpError byte
UnmatchedOpError is returned if a block does not have a corresponding end instruction, or if an else instruction is encountered outside of an if block.
func (UnmatchedOpError) Error ¶
func (e UnmatchedOpError) Error() string