summaryrefslogtreecommitdiff
path: root/tests/varlocs.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2018-06-06 23:35:35 +0200
committerMark Wielaard <mark@klomp.org>2018-06-08 12:03:14 +0200
commit07d2098890e9113079bae64f6fc7f4069f7b12cd (patch)
treedb486d7167a4eb824b0876ebd4eb0bd87c96fdff /tests/varlocs.c
parent7ae7ec1ad75dd0689b5371c2e157165c4c7944c9 (diff)
downloadelfutils-07d2098890e9113079bae64f6fc7f4069f7b12cd.tar.gz
tests: Use error, not assert, when trying to print a non-base type DIE.
When using the varlocs test with a fuzzer using assert for internal sanity checks is great to find issues. But when encountering bad data using an assert is wrong. Just use error to show we handle the data correctly (by reporting it is bad, instead of crashing). Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'tests/varlocs.c')
-rw-r--r--tests/varlocs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/varlocs.c b/tests/varlocs.c
index 31a1069a..2ddd3d8f 100644
--- a/tests/varlocs.c
+++ b/tests/varlocs.c
@@ -122,7 +122,8 @@ dwarf_form_string (unsigned int form)
static void
print_base_type (Dwarf_Die *base)
{
- assert (dwarf_tag (base) == DW_TAG_base_type);
+ if (dwarf_tag (base) != DW_TAG_base_type)
+ error (EXIT_FAILURE, 0, "not a base type");
Dwarf_Attribute encoding;
Dwarf_Word enctype = 0;