[elflib] Ignore stated section header size when we have no sections

Stripped binaries like to remove sections entirely and sometimes zero
out the e_shentsize field. We should ignore the field in such cases.

Test: Manual
Change-Id: I480b050c4627798c3231205f6e40815c67bb5b1e
diff --git a/lib/elflib/elflib.cc b/lib/elflib/elflib.cc
index 4c6f16c..6799ed1 100644
--- a/lib/elflib/elflib.cc
+++ b/lib/elflib/elflib.cc
@@ -40,8 +40,11 @@
 
   out->header_ = *reinterpret_cast<Elf64_Ehdr*>(header_data->data());
 
-  // We don't support non-standard section header sizes.
-  if (out->header_.e_shentsize != sizeof(Elf64_Shdr)) {
+  // We don't support non-standard section header sizes. Stripped binaries that
+  // don't have sections sometimes zero out the shentsize, so we can ignore it
+  // if we have no sections.
+  if (out->header_.e_shnum > 0 &&
+      out->header_.e_shentsize != sizeof(Elf64_Shdr)) {
     return std::unique_ptr<ElfLib>();
   }