summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-11-20 13:53:10 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-11-20 13:53:10 (GMT)
commitd1f4b6b501f477a0ed9af4abadc5995b835b5ba2 (patch)
treec096673f2724c54aaedbb6b57f7d3473f5223bbe
parent67248baaf98c3c8555dfa85f532c6a840eab10b6 (diff)
parentf5cd92a82600067835c05c7e82726161a150a50b (diff)
downloadCMake-d1f4b6b501f477a0ed9af4abadc5995b835b5ba2.zip
CMake-d1f4b6b501f477a0ed9af4abadc5995b835b5ba2.tar.gz
CMake-d1f4b6b501f477a0ed9af4abadc5995b835b5ba2.tar.bz2
Merge topic 'avoid-divide-by-zero'
f5cd92a8 cmELF: Avoid divide by zero if there are no dynamic section entries
-rw-r--r--Source/cmELF.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index d062987..37dd328 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);