WebAssembly / interface-types

Other
642 stars 57 forks source link

validateUtf8 typo in Explainer example #121

Closed binyomen closed 4 years ago

binyomen commented 4 years ago

In the example detailing how two adapted modules could be merged together by a wasm engine, the $validateUtf8 function is called twice. However, both times it's called on the same string. I think the second instance should be called on $valSrc and $valLen rather than $keySrc and $keyLen.

Actual

...
    let (local $valSrc i32) (local $valLen i32) (result i32 i32)
        (call $validateUtf8 (local.get $keySrc) (local.get $keyLen))
        (call $mem2Malloc (local.get $valLen))
...

Expected

...
    let (local $valSrc i32) (local $valLen i32) (result i32 i32)
        (call $validateUtf8 (local.get $valSrc) (local.get $valLen))
        (call $mem2Malloc (local.get $valLen))
...
fgmccabe commented 4 years ago

Comment is correct. However, the explainer is in the middle of a significant rewrite that make the issue moot.