WebAssembly / WebAssembly/binaryen

Questions Related to the Validation of Raw Input Bytes in C API

Open
#6,194 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

Hi developers, I have a problem (or somewhat feature request) related to the C API. Given a raw bytes stream, I need to validate whether it is a valid wasm module or not. In current binaryen-c.h file, we have BinaryenModuleRead and BinaryenModuleValidate to parse raw bytes into a BinaryenModule and validate BinaryenModule respectively.

However, for BinaryenModuleRead, it will exit the process if the input raw bytes are invalid, for BinaryenModuleValidate it will print error messages to the stdout/stderr and requires a BinaryenModuleRef as parameter, so I want to know if there is an API that takes raw bytes as input, returns 1 for valid and 0 for invalid, and does nothing else (just like the WebAssembly.validate() in JS-Wasm API) ?

Thanks in advance for any kind response.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with binaryen-c.h and compare the behavior and contracts of BinaryenModuleRead and BinaryenModuleValidate. Check how the C API handles invalid raw bytes and diagnostics, using WebAssembly.validate() as the requested behavior reference. Done means a documented raw-byte validation entry point can report validity without exiting the process or emitting output.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, wasm
Domain
api, compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.