summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-11-19 13:20:47 -0500
committerBrad King <brad.king@kitware.com>2015-11-19 13:20:47 -0500
commit16ba21f79abbd4729124c8c042b66da482500e9c (patch)
tree51b4f876e8a095986625f48f67377e713e05789e
parentaa0460b34a8533ee5c0e0893b411f72b5784c842 (diff)
parentf5cd92a82600067835c05c7e82726161a150a50b (diff)
downloadcmake-16ba21f79abbd4729124c8c042b66da482500e9c.tar.gz
Merge branch 'avoid-divide-by-zero' into release
-rw-r--r--Source/cmELF.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index d062987b10..37dd328dbe 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -567,8 +567,14 @@ bool cmELFInternalImpl<Types>::LoadDynamicSection()
return true;
}
- // Allocate the dynamic section entries.
+ // If there are no entries we are done.
ELF_Shdr const& sec = this->SectionHeaders[this->DynamicSectionIndex];
+ if(sec.sh_entsize == 0)
+ {
+ return false;
+ }
+
+ // Allocate the dynamic section entries.
int n = static_cast<int>(sec.sh_size / sec.sh_entsize);
this->DynamicSectionEntries.resize(n);