public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [opcodes/arm] Fix potential null pointer dereferences
@ 2022-11-03  7:15 Luis Machado
  2022-11-03  9:14 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Machado @ 2022-11-03  7:15 UTC (permalink / raw)
  To: binutils

  PR 29598: dereferenced null pointer in arm-dis.c

  As pointed out in the bug ticket, we have a couple potential null pointer
  dereferencing situations for mapping_symbol_for_insn. Harden those.
---
 opcodes/arm-dis.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 31ed81f5a4e..01b43582513 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -12482,6 +12482,10 @@ mapping_symbol_for_insn (bfd_vma pc, struct disassemble_info *info,
   bool found = false;
   bool can_use_search_opt_p = false;
 
+  /* Sanity check.  */
+  if (info == NULL)
+    return false;
+
   /* Default to DATA.  A text section is required by the ABI to contain an
      INSN mapping symbol at the start.  A data section has no such
      requirement, hence if no mapping symbol is found the section must
@@ -12495,7 +12499,7 @@ mapping_symbol_for_insn (bfd_vma pc, struct disassemble_info *info,
     type = MAP_ARM;
   struct arm_private_data *private_data;
 
-  if (info->private_data == NULL
+  if (info->private_data == NULL || info->symtab == NULL
       || info->symtab_size == 0
       || bfd_asymbol_flavour (*info->symtab) != bfd_target_elf_flavour)
     return false;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [opcodes/arm] Fix potential null pointer dereferences
  2022-11-03  7:15 [PATCH] [opcodes/arm] Fix potential null pointer dereferences Luis Machado
@ 2022-11-03  9:14 ` Nick Clifton
  2022-11-10  1:13   ` Luis Machado
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2022-11-03  9:14 UTC (permalink / raw)
  To: Luis Machado, binutils

Hi Luis,

>    PR 29598: dereferenced null pointer in arm-dis.c
> 
>    As pointed out in the bug ticket, we have a couple potential null pointer
>    dereferencing situations for mapping_symbol_for_insn. Harden those.

Approved - please apply.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [opcodes/arm] Fix potential null pointer dereferences
  2022-11-03  9:14 ` Nick Clifton
@ 2022-11-10  1:13   ` Luis Machado
  0 siblings, 0 replies; 3+ messages in thread
From: Luis Machado @ 2022-11-10  1:13 UTC (permalink / raw)
  To: Nick Clifton, binutils

On 11/3/22 09:14, Nick Clifton wrote:
> Hi Luis,
> 
>>    PR 29598: dereferenced null pointer in arm-dis.c
>>
>>    As pointed out in the bug ticket, we have a couple potential null pointer
>>    dereferencing situations for mapping_symbol_for_insn. Harden those.
> 
> Approved - please apply.
> 
> Cheers
>    Nick
> 

Thanks. Pushed now.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-10  1:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03  7:15 [PATCH] [opcodes/arm] Fix potential null pointer dereferences Luis Machado
2022-11-03  9:14 ` Nick Clifton
2022-11-10  1:13   ` Luis Machado

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).