summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2023-04-06 16:49:27 +0200
committerMark Wielaard <mark@klomp.org>2023-04-14 17:25:03 +0200
commit3daddabd5d619bc2316813a5676d9be34ad3f6ac (patch)
treef8689d790ab9839774977bf327f6e9549e22b4b7
parent7676df99484184ff971cf37f3aa54d5e457d6e35 (diff)
downloadelfutils-3daddabd5d619bc2316813a5676d9be34ad3f6ac.tar.gz
backends: Check results for NULL early in dwarf_peeled_die_type
Calling dwarf_peeled_die_type with a NULL results pointer is an error, check early that result is not NULL so dwarf_formref_die and dwarf_peel_type won't try to set the NULL Dwarf_Die. * backends/libebl_CPU.h (dwarf_peeled_die_type): Move check for results == NULL to start of function. Signed-off-by: Mark Wielaard <mark@klomp.org>
-rw-r--r--backends/libebl_CPU.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/backends/libebl_CPU.h b/backends/libebl_CPU.h
index 3b2cc3e4..d138f5f7 100644
--- a/backends/libebl_CPU.h
+++ b/backends/libebl_CPU.h
@@ -66,13 +66,13 @@ dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result)
/* The function has no return value, like a `void' function in C. */
return 0;
- if (dwarf_formref_die (attr, result) == NULL)
+ if (result == NULL)
return -1;
- if (dwarf_peel_type (result, result) != 0)
+ if (dwarf_formref_die (attr, result) == NULL)
return -1;
- if (result == NULL)
+ if (dwarf_peel_type (result, result) != 0)
return -1;
int tag = dwarf_tag (result);