Skip to main content

decode_bytecode

Function decode_bytecode 

Source
pub fn decode_bytecode(bytes: &[u8]) -> Result<BytecodeProgram, BytecodeError>
Expand description

Parse a .rbc byte stream back into a program.

The input is untrusted: the version is checked before anything else, every length is bounded against the remaining buffer, and the decoded program is run through validate_program so that out-of-range operands surface as BytecodeError::Corrupt instead of panicking the executor later.

ยงErrors

Returns BytecodeError when the stream is truncated, carries the wrong magic or version, or fails validation.