diff options
author | Alon Zakai <azakai@google.com> | 2020-07-01 11:27:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-01 11:27:54 -0700 |
commit | cd0cc95e2794375c463a69833b1ccc9cc96d597c (patch) | |
tree | dbd2d667ccf21d17da3e16936c828f0614633c11 /src | |
parent | de9f46eb7d6ab13671019335d3dc5bd98179431c (diff) | |
download | binaryen-cd0cc95e2794375c463a69833b1ccc9cc96d597c.tar.gz binaryen-cd0cc95e2794375c463a69833b1ccc9cc96d597c.tar.bz2 binaryen-cd0cc95e2794375c463a69833b1ccc9cc96d597c.zip |
DWARF: Ignore debug_loc spans that are invalid (#2939)
An (x, y) span is updated to some (q, r) in the new binary. If q > r then the
span is no longer valid - the optimizer has reordered things too much.
It's possible this could be flipped, but I'm not certain. It seems safer to
just omit these, which are very rare (I only see this on some larger
testcases in the emscripten test suite).
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm/wasm-debug.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wasm/wasm-debug.cpp b/src/wasm/wasm-debug.cpp index 112c805d8..c8e8c07a4 100644 --- a/src/wasm/wasm-debug.cpp +++ b/src/wasm/wasm-debug.cpp @@ -992,8 +992,9 @@ static void updateLoc(llvm::DWARFYAML::Data& yaml, // a new address for it. newStart = locationUpdater.getNewStart(loc.Start + oldBase); newEnd = locationUpdater.getNewEnd(loc.End + oldBase); - if (newStart == 0 || newEnd == 0) { - // This part of the loc no longer has a mapping, so we must ignore it. + if (newStart == 0 || newEnd == 0 || newStart > newEnd) { + // This part of the loc no longer has a mapping, or after the mapping + // it is no longer a proper span, so we must ignore it. newStart = newEnd = IGNOREABLE_LOCATION; } else { // We picked a new base that ensures it is smaller than the values we |