validate

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: BSD-3-Clause Imports: 11 Imported by: 16

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 added in v0.6.0

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 added in v0.6.0

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 added in v0.6.0

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 added in v0.6.0

func (e UnbalancedStackErr) 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