]> sourceware.org Git - libabigail.git/commitdiff
dwarf-reader: remove superfluous ABG_ASSERT
authorMatthias Maennich <maennich@google.com>
Sun, 15 Mar 2020 12:55:12 +0000 (13:55 +0100)
committerDodji Seketeli <dodji@redhat.com>
Wed, 18 Mar 2020 22:10:14 +0000 (23:10 +0100)
maybe_adjust_et_rel_sym_addr_to_abs_addr contained an ABG_ASSERT to
ensure symbol_section is not used on an invalid value. Since
maybe_adjust_et_rel_sym_addr_to_abs_addr handles this case, this assert
can be removed.

* src/abg-dwarf-reader.cc
(maybe_adjust_et_rel_sym_addr_to_abs_addr): improve NULL check,
remove superfluous ABG_ASSERT
* tests/data/Makefile.am: Add new test case to the distribution.
* tests/test-read-dwarf.cc: Likewise.
* tests/data/test-read-dwarf/test27-bogus-binary.elf: New test case.

Signed-off-by: Matthias Maennich <maennich@google.com>
src/abg-dwarf-reader.cc
tests/data/Makefile.am
tests/data/test-read-dwarf/test27-bogus-binary.elf [new file with mode: 0644]
tests/test-read-dwarf.cc

index 3454fcf5cf7c1ce80440b511f713d158ad0b3e4f..ff532cfd244ea48b4ce52c5135823e29c256c4b6 100644 (file)
@@ -8585,7 +8585,7 @@ public:
   GElf_Addr
   maybe_adjust_et_rel_sym_addr_to_abs_addr(GElf_Addr addr, Elf_Scn *section)
   {
-    if (section == 0)
+    if (!section)
       return addr;
 
     Elf* elf = elf_handle();
@@ -8623,7 +8623,6 @@ public:
   maybe_adjust_et_rel_sym_addr_to_abs_addr(GElf_Sym *sym)
   {
     Elf_Scn *symbol_section = elf_getscn(elf_handle(), sym->st_shndx);
-    ABG_ASSERT(symbol_section);
     GElf_Addr result = sym->st_value;
     result = maybe_adjust_et_rel_sym_addr_to_abs_addr(result, symbol_section);
     return result;
index 21ae846b177cab19eb4dcf5b203c75e3d4c8817f..e9fdad1e1d8d664402611eac63744becfca217dd 100644 (file)
@@ -442,6 +442,7 @@ test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0 \
 test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi \
 test-read-dwarf/test25-bogus-binary.elf \
 test-read-dwarf/test26-bogus-binary.elf \
+test-read-dwarf/test27-bogus-binary.elf \
 \
 test-annotate/test0.abi                        \
 test-annotate/test1.abi                        \
diff --git a/tests/data/test-read-dwarf/test27-bogus-binary.elf b/tests/data/test-read-dwarf/test27-bogus-binary.elf
new file mode 100644 (file)
index 0000000..3240f53
Binary files /dev/null and b/tests/data/test-read-dwarf/test27-bogus-binary.elf differ
index a8ea0619ccbb3c9f061626db2971d809851d6f1c..7c99d21889d01215e02b85a11c955d2b0d48a093 100644 (file)
@@ -265,6 +265,12 @@ InOutSpec in_out_specs[] =
     "",
     "",
   },
+  {
+    "data/test-read-dwarf/test27-bogus-binary.elf",
+    "",
+    "",
+    "",
+  },
   // This should be the last entry.
   {NULL, NULL, NULL, NULL}
 };
This page took 0.043418 seconds and 5 git commands to generate.