validate

package
v0.6.1-0...-67507c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package validate provides functions for validating WebAssembly modules.

Index

Constants

This section is empty.

Variables

View Source
var ErrStackUnderflow = errors.New("validate: stack underflow")

ErrStackUnderflow is returned if an instruction consumes a value, but there are no values on the stack.

View Source
var PrintDebugInfo = false

Functions

func VerifyModule

func VerifyModule(module *wasm.Module) error

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.

func (Error) Error

func (e Error) Error() string

type InvalidImmediateError

type InvalidImmediateError struct {
	ImmType string
	OpName  string
}

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

type InvalidTypeError struct {
	Wanted wasm.ValueType
	Got    wasm.ValueType
}

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

type NoSectionError wasm.SectionID

NoSectionError is returned if a section does not exist.

func (NoSectionError) Error

func (e NoSectionError) Error() string

type UnbalancedStackErr

type UnbalancedStackErr wasm.ValueType

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

type UnmatchedIfValueErr wasm.ValueType

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL