summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-binary.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index e44f9fb83..4844dd5b4 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1241,7 +1241,11 @@ Name WasmBinaryBuilder::getInlineString() {
auto len = getU32LEB();
std::string str;
for (size_t i = 0; i < len; i++) {
- str = str + char(getInt8());
+ auto curr = char(getInt8());
+ if (curr == 0) {
+ throw ParseException("inline string contains NULL (0). that is technically valid in wasm, but you shouldn't do it, and it's not supported in binaryen");
+ }
+ str = str + curr;
}
if (debug) std::cerr << "getInlineString: " << str << " ==>" << std::endl;
return Name(str);