From 301bfc45abb5ea2824a4d1820183b58d0d67357d Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 3 Apr 2024 11:19:33 +0100 Subject: Fix null pointer dereference in process_debug_info() --- binutils/dwarf.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'binutils') diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 92a07e0..ce508d0 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -4248,14 +4248,17 @@ process_debug_info (struct dwarf_section * section, compunit.cu_version, debug_info_p); - /* This check was in place before, keep it. */ - stemp = debug_info_p->rnglists_base; - if (stemp < 0) + if (debug_info_p) { - warn (_("CU @ %#" PRIx64 " has has a negative rnglists_base " - "value of %#" PRIx64 " - treating as zero"), - debug_info_p->cu_offset, stemp); - debug_info_p->rnglists_base = 0; + /* This check was in place before, keep it. */ + stemp = debug_info_p->rnglists_base; + if (stemp < 0) + { + warn (_("CU @ %#" PRIx64 " has has a negative rnglists_base " + "value of %#" PRIx64 " - treating as zero"), + debug_info_p->cu_offset, stemp); + debug_info_p->rnglists_base = 0; + } } } -- cgit v1.1