[Lldb-commits] [lldb] r208749 - Don't assert and crash when sections are malformed.
Greg Clayton
gclayton at apple.com
Tue May 13 18:12:10 PDT 2014
Author: gclayton
Date: Tue May 13 20:12:09 2014
New Revision: 208749
URL: http://llvm.org/viewvc/llvm-project?rev=208749&view=rev
Log:
Don't assert and crash when sections are malformed.
<rdar://problem/16833247>
Modified:
lldb/trunk/source/Core/Section.cpp
Modified: lldb/trunk/source/Core/Section.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Section.cpp?rev=208749&r1=208748&r2=208749&view=diff
==============================================================================
--- lldb/trunk/source/Core/Section.cpp (original)
+++ lldb/trunk/source/Core/Section.cpp Tue May 13 20:12:09 2014
@@ -331,10 +331,13 @@ SectionList::operator = (const SectionLi
size_t
SectionList::AddSection (const lldb::SectionSP& section_sp)
{
- assert (section_sp.get());
- size_t section_index = m_sections.size();
- m_sections.push_back(section_sp);
- return section_index;
+ if (section_sp)
+ {
+ size_t section_index = m_sections.size();
+ m_sections.push_back(section_sp);
+ return section_index;
+ }
+ return SIZE_T_MAX;
}
// Warning, this can be slow as it's removing items from a std::vector.
@@ -433,14 +436,16 @@ SectionList::FindSectionByName (const Co
for (sect_iter = m_sections.begin(); sect_iter != end && sect_sp.get() == NULL; ++sect_iter)
{
Section *child_section = sect_iter->get();
- assert (child_section);
- if (child_section->GetName() == section_dstr)
- {
- sect_sp = *sect_iter;
- }
- else
+ if (child_section)
{
- sect_sp = child_section->GetChildren().FindSectionByName(section_dstr);
+ if (child_section->GetName() == section_dstr)
+ {
+ sect_sp = *sect_iter;
+ }
+ else
+ {
+ sect_sp = child_section->GetChildren().FindSectionByName(section_dstr);
+ }
}
}
}
More information about the lldb-commits
mailing list