diff options
author | Heejin Ahn <aheejin@users.noreply.github.com> | 2016-08-05 08:41:48 -0700 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2016-08-05 08:41:48 -0700 |
commit | 49b99e6675424ff0866a670ed83f2393330198dd (patch) | |
tree | 28cbf686628df7d46f05574faaa20921cb77af22 /src | |
parent | e8da13d1e4d0b553ef103d196e83a93f0e64ed8a (diff) | |
download | binaryen-49b99e6675424ff0866a670ed83f2393330198dd.tar.gz binaryen-49b99e6675424ff0866a670ed83f2393330198dd.tar.bz2 binaryen-49b99e6675424ff0866a670ed83f2393330198dd.zip |
Fix a parsing bug introduced by #615 (#661)
Name lhs = getStrToSep();
if (!skipEqual()){
s = strchr(s, '\n');
if (!s) break;
continue;
}
The above code snippet introduced by #615 has a bug when there is only
one word (e.g. ".text") in a line. If there is only one word in a line,
skipEqual() also skips the newline character at the end of the line, and
strchr(s, '\n') moves the cursor to the end of the next line,
effectively skipping the whole next line.
Diffstat (limited to 'src')
-rw-r--r-- | src/s2wasm.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h index 5614c7b58..b17ed0702 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -399,6 +399,10 @@ class S2WasmBuilder { // add data aliases } else { Name lhs = getStrToSep(); + // When the current line contains only one word, e.g.".text" + if (match("\n")) + continue; + // When the current line contains more than one word if (!skipEqual()){ s = strchr(s, '\n'); if (!s) break; |