wabt icon indicating copy to clipboard operation
wabt copied to clipboard

Adding some validation of custom sections (e.g. linking section)

Open sbc100 opened this issue 6 years ago • 3 comments

wabt currently knows how to parse some custom sections, such as the linking section which are outside of the core spec.

I'd like to add some amount of validation there but its not clear where best to do this. Presumably not in ReadBinaryIr? Would it make sense to add this to ValidateModule? (disabled with the existing --ignore-custom-section-errors option)

sbc100 avatar Sep 24 '19 22:09 sbc100

It probably won't work in ValidateModule, since that would require you to read the data into IR first.

I think the way that fits best with the current design would be to create a separate class for validating linking info. It would have a collection of functions that map directly to the callbacks in binary-reader.h. Then anyone who wants to validate that custom section can forward the calls. It's a bit clumsy with the current design, but that would mean you could share validation between wasm2wat and wasm-objdump, for example.

binji avatar Sep 25 '19 20:09 binji

And it would make sense to you to run it as part of wasm-validate?

sbc100 avatar Sep 25 '19 21:09 sbc100

Maybe not by default, but I think it makes sense as a flag.

binji avatar Sep 25 '19 21:09 binji