diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index d3efb02a9dbf..555170eccdf0 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -7388,6 +7388,11 @@ public:
     GElf_Shdr header_mem;
     GElf_Shdr* symtab_sheader = gelf_getshdr(symtab_section,
 					     &header_mem);
+
+    // check for bogus section header
+    if (symtab_sheader->sh_entsize == 0)
+      return false;
+
     size_t nb_syms = symtab_sheader->sh_size / symtab_sheader->sh_entsize;
 
     Elf_Data* symtab = elf_getdata(symtab_section, 0);
diff --git a/tests/data/test-read-dwarf/test25-bogus-binary.elf b/tests/data/test-read-dwarf/test25-bogus-binary.elf
new file mode 100644
index 0000000000000000000000000000000000000000..b00a9696232bd813aa413808e56e6875a3069a03
GIT binary patch
diff --git a/tests/test-read-dwarf.cc b/tests/test-read-dwarf.cc
index 7c656964c93c..8f460fef3f8f 100644
--- a/tests/test-read-dwarf.cc
+++ b/tests/test-read-dwarf.cc
@@ -253,6 +253,12 @@ InOutSpec in_out_specs[] =
     "output/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi",
   },
 #endif
+  {
+    "data/test-read-dwarf/test25-bogus-binary.elf",
+    "",
+    "",
+    "",
+  },
   // This should be the last entry.
   {NULL, NULL, NULL, NULL}
 };
@@ -324,6 +330,12 @@ struct test_task : public abigail::workers::task
       set_suppressions(*ctxt, in_suppr_spec_path);
 
     abigail::corpus_sptr corp = read_corpus_from_elf(*ctxt, status);
+    // if there is no output and no input, assume that we do not care about the
+    // actual read result, just that it succeeded.
+    if (in_abi_path.empty() && out_abi_path.empty()) {
+	// Phew! we made it here and we did not crash! yay!
+	return;
+    }
     if (!corp)
       {
 	error_message = string("failed to read ") + in_elf_path  + "\n";
