From d585a20394704bc7812489fc7a6af8136589c465 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 14 Sep 2017 17:46:23 +0000 Subject: [PATCH] [test] Fix TestDWARFDieRangeInfoIntersects Fixes heap buffer overflow triggered in DWARF verifier, detected by ASAN. llvm-svn: 313280 --- llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp index 04530c44d87a..24a0e67b003b 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/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) {