Merge "Add sanity checks for e_shentsize and e_shstrndx"

This commit is contained in:
Dimitry Ivanov 2016-07-22 22:44:53 +00:00 committed by Gerrit Code Review
commit 12ba7e51d9
1 changed files with 11 additions and 0 deletions

View File

@ -245,6 +245,17 @@ bool ElfReader::VerifyElfHeader() {
return false;
}
if (header_.e_shentsize != sizeof(ElfW(Shdr))) {
DL_ERR("\"%s\" has unsupported e_shentsize: 0x%x (expected 0x%zx)",
name_.c_str(), header_.e_shentsize, sizeof(ElfW(Shdr)));
return false;
}
if (header_.e_shstrndx == 0) {
DL_ERR("\"%s\" has invalid e_shstrndx", name_.c_str());
return false;
}
return true;
}