binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

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

Open mobsceneZ opened this issue 1 year ago • 1 comments

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.

mobsceneZ avatar Jan 02 '24 10:01 mobsceneZ

Looks like there isn't such an API atm. I wouldn't be opposed to adding one if we find a good design for it.

kripken avatar Jan 02 '24 17:01 kripken