From: Jonas Devlieghere Date: Thu, 14 Sep 2017 17:46:23 +0000 (+0000) Subject: [test] Fix TestDWARFDieRangeInfoIntersects X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c189ccb9a2084baddc54ee15f03fcafbcf46b83e;p=llvm [test] Fix TestDWARFDieRangeInfoIntersects Fixes heap buffer overflow triggered in DWARF verifier, detected by ASAN. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313280 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/lib/DebugInfo/DWARF/DWARFVerifier.cpp index 04530c44d87..24a0e67b003 100644 --- a/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -89,6 +89,8 @@ bool DWARFVerifier::DieRangeInfo::intersects(const DieRangeInfo &RHS) const { auto End = Ranges.end(); auto Iter = findRange(RHS.Ranges.front()); for (const auto &R : RHS.Ranges) { + if(Iter == End) + return false; if (R.HighPC <= Iter->LowPC) continue; while (Iter != End) {