diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-01-22 17:15:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-22 17:15:37 -0800 |
commit | e63c4a7d04c145dafaf4b09de5f9f5de69cee8ef (patch) | |
tree | ad8cbf7bd25c2fb9928032955b3fc8ba46033a43 /src/emscripten-optimizer | |
parent | 0e5e55053c171b138a0cf5aa8a08de8c7714048f (diff) | |
download | binaryen-e63c4a7d04c145dafaf4b09de5f9f5de69cee8ef.tar.gz binaryen-e63c4a7d04c145dafaf4b09de5f9f5de69cee8ef.tar.bz2 binaryen-e63c4a7d04c145dafaf4b09de5f9f5de69cee8ef.zip |
More misc ASAN fixes (#1882)
* fix buffer overflow in simple_ast.h printing.
* check wasm binary format reading of function export indexes for errors.
* check if s-expr format imports have a non-empty module and base.
Fixes #1876
Fixes #1877
Fixes #1879
Diffstat (limited to 'src/emscripten-optimizer')
-rw-r--r-- | src/emscripten-optimizer/istring.h | 4 | ||||
-rw-r--r-- | src/emscripten-optimizer/simple_ast.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/emscripten-optimizer/istring.h b/src/emscripten-optimizer/istring.h index 5a7d05162..5c3b094c3 100644 --- a/src/emscripten-optimizer/istring.h +++ b/src/emscripten-optimizer/istring.h @@ -149,6 +149,10 @@ struct IString { bool startsWith(const char *prefix) const { return stripPrefix(prefix) != nullptr; } + + size_t size() const { + return str ? strlen(str) : 0; + } }; } // namespace cashew diff --git a/src/emscripten-optimizer/simple_ast.h b/src/emscripten-optimizer/simple_ast.h index de8122ba1..f38377e70 100644 --- a/src/emscripten-optimizer/simple_ast.h +++ b/src/emscripten-optimizer/simple_ast.h @@ -561,6 +561,7 @@ struct JSPrinter { void printAst() { print(ast); + ensure(1); buffer[used] = 0; } |