summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm.h2
-rw-r--r--third_party/llvm-project/DWARFVisitor.cpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/wasm.h b/src/wasm.h
index 9aafb7425..8b60885e3 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -1170,7 +1170,7 @@ using BinaryLocation = uint32_t;
// Offsets are relative to the beginning of the code section, as in DWARF.
struct BinaryLocations {
struct Span {
- BinaryLocation start, end;
+ BinaryLocation start = 0, end = 0;
};
std::unordered_map<Expression*, Span> expressions;
std::unordered_map<Function*, Span> functions;
diff --git a/third_party/llvm-project/DWARFVisitor.cpp b/third_party/llvm-project/DWARFVisitor.cpp
index 35d5ccf57..05c4194e3 100644
--- a/third_party/llvm-project/DWARFVisitor.cpp
+++ b/third_party/llvm-project/DWARFVisitor.cpp
@@ -55,6 +55,13 @@ template <typename T> void DWARFYAML::VisitorImpl<T>::traverseDebugInfo() {
onStartDIE(Unit, Entry);
if (Entry.AbbrCode == 0u)
continue;
+ // XXX BINARYEN
+ if (Entry.AbbrCode - FirstAbbrevCode >= DebugInfo.AbbrevDecls.size()) {
+ errs() << "warning: invalid abbreviation code " << Entry.AbbrCode <<
+ " (range: " << FirstAbbrevCode << "-" <<
+ (DebugInfo.AbbrevDecls.size() - FirstAbbrevCode) << ")\n";
+ continue;
+ }
auto &Abbrev = DebugInfo.AbbrevDecls[Entry.AbbrCode - FirstAbbrevCode];
auto FormVal = Entry.Values.begin();
auto AbbrForm = Abbrev.Attributes.begin();