webassemblyjs icon indicating copy to clipboard operation
webassemblyjs copied to clipboard

Bug: cannot read property 'charCodeAt' of undefined

Open yevgenypats opened this issue 6 years ago • 2 comments

Hey,

Found the following bug that can be reproduced with:

const wast = require("@webassemblyjs/wast-parser");
wast.parse('"\u0019g ')

Thrown:
TypeError: Cannot read property 'charCodeAt' of undefined
    at isNewLine (/Users/yevgenyp/fuzzitdev/jsfuzz/node_modules/@webassemblyjs/wast-parser/lib/tokenizer.js:33:15)
    at tokenize (/Users/yevgenyp/fuzzitdev/jsfuzz/node_modules/@webassemblyjs/wast-parser/lib/tokenizer.js:347:13)
    at Object.parse (/Users/yevgenyp/fuzzitdev/jsfuzz/node_modules/@webassemblyjs/wast-parser/lib/index.js:31:40)

Found using jsfuzz

yevgenypats avatar Oct 20 '19 10:10 yevgenypats

Would you mind sending a PR?

xtuc avatar Oct 23 '19 09:10 xtuc

hey @xtuc !:) I'm not sure I'll have time in the near future but I suggest marking this as bug/help wanted and maybe someone will be able to contribute the PR before me.

yevgenypats avatar Oct 25 '19 15:10 yevgenypats