Skip to content

Commit

Permalink
wasm-decompile: Fix unescaped characters in data output. (WebAssembly…
Browse files Browse the repository at this point in the history
…#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).
  • Loading branch information
fedosgad authored Nov 4, 2024
1 parent da297e0 commit 81d6ac4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/decompiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 += '\\';
Expand Down

0 comments on commit 81d6ac4

Please sign in to comment.