Skip to content

fix(decoder): additional assert_malformed improvements #148

@avrabe

Description

@avrabe

Problem

Several assert_malformed tests fail because the decoder doesn't detect specific malformed conditions. ~35 total failures.

Specific gaps

Category Count Description
data count section required 4 Code section uses data.drop/memory.init but no data count section exists
malformed limits flags 4 Limits flags byte must be 0x00-0x03 (or 0x04-0x07 with memory64)
integer too large 9 LEB128 overflow not detected in some contexts
integer representation too long 3 LEB128 encoding uses more bytes than necessary
too many locals 4 Function declares more locals than allowed
unexpected end of section 4 Section contents shorter than declared size
section size mismatch 2 Section size doesn't match content
malformed reference type 2 Invalid reference type encoding
malformed memop flags 2 Invalid memory operation flags
illegal opcode 3 Undefined opcodes (e.g., 0xFF)
END opcode expected 2 Missing end opcode
malformed mutability 1 Invalid mutability flag

Files

  • kiln-decoder/src/streaming_decoder.rs — main decoder
  • kiln-build-core/src/wast_validator.rs — some checks may belong in validator

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions