* [PATCH] backends: Check results for NULL early in dwarf_peeled_die_type
@ 2023-04-06 15:04 Mark Wielaard
2023-04-14 15:26 ` Mark Wielaard
0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2023-04-06 15:04 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mark Wielaard
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>
---
backends/libebl_CPU.h | 6 +++---
1 file 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);
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] backends: Check results for NULL early in dwarf_peeled_die_type
2023-04-06 15:04 [PATCH] backends: Check results for NULL early in dwarf_peeled_die_type Mark Wielaard
@ 2023-04-14 15:26 ` Mark Wielaard
0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2023-04-14 15:26 UTC (permalink / raw)
To: elfutils-devel
Hi,
On Thu, 2023-04-06 at 17:04 +0200, Mark Wielaard wrote:
> 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.
Pushed,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-14 15:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-06 15:04 [PATCH] backends: Check results for NULL early in dwarf_peeled_die_type Mark Wielaard
2023-04-14 15:26 ` Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).