From 81d6ac4a5d43c8329639bb88fc39f3ca6424896a Mon Sep 17 00:00:00 2001 From: fedosgad Date: Mon, 4 Nov 2024 19:51:27 +0300 Subject: [PATCH] wasm-decompile: Fix unescaped characters in data output. (#2500) Characters `"` and `\` which have special meaning in data representations are not escaped by wasm-decompile and are passed to output as is. This PR fixes such incorrect behavior. All tests still pass (although no cases are added). --- src/decompiler.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/decompiler.cc b/src/decompiler.cc index cdb0a7838..7881ce883 100644 --- a/src/decompiler.cc +++ b/src/decompiler.cc @@ -702,7 +702,7 @@ struct Decompiler { size_t line_start = 0; static const char s_hexdigits[] = "0123456789abcdef"; for (auto c : in) { - if (c >= ' ' && c <= '~') { + if (c >= ' ' && c <= '~' && c != '"' && c != '\\') { s += c; } else { s += '\\';