wabt icon indicating copy to clipboard operation
wabt copied to clipboard

Fix issue#2445 Null Pointer Deref

Open haruki3hhh opened this issue 1 year ago • 7 comments

Fix issue 2445: https://github.com/WebAssembly/wabt/issues/2445

haruki3hhh avatar Sep 11 '24 03:09 haruki3hhh

Hi, After adding this patch, execute the poc, it shows:

# ./wat2wasm ../@POC@
../@POC@:1:2: error: error in quoted module: @0x100000001: unexpected token "|", expected a module field or a module.
(module quote "\7c")
 ^^^^^^

And ASAN is not triggered.

Do you think we should make some further improvements about it? I'm glad to do it, if needed.

haruki3hhh avatar Sep 11 '24 20:09 haruki3hhh

It would be good to add that as a test case I think. Seems like the kind of test that could also be upstreamed to the wasm spec test suite too (once it lands here).

sbc100 avatar Sep 11 '24 20:09 sbc100

If I want to add it into test case, should I directly add a .txt file to https://github.com/WebAssembly/wabt/tree/main/test/parse?

haruki3hhh avatar Sep 11 '24 20:09 haruki3hhh

@sbc100 @SoniEx2 Hi folks, I added a testcase, could you also please take a look at it?

https://github.com/WebAssembly/wabt/pull/2461/files#diff-198b0c14be90b6dbd98ff0d8d3289a686f4daa9733c748db3dadfaa5c55635fd

haruki3hhh avatar Sep 15 '24 17:09 haruki3hhh

the test looks great. wonder if it would make sense to upstream it...

SoniEx2 avatar Sep 15 '24 17:09 SoniEx2

Hi folks, @SoniEx2 @sbc100

Do you think I need to do some further improvements for this patch? Or we can merge it?

I'd like to help, if further improvements are needed!

haruki3hhh avatar Dec 06 '24 03:12 haruki3hhh

ParseWatModule returns a Result, it would be a good idea to check that Result.

SoniEx2 avatar Dec 06 '24 10:12 SoniEx2