metag uninitialized memory read

Message ID 20200320020822.GH4583@bubble.grove.modra.org
State New
Headers show
Series
  • metag uninitialized memory read
Related show

Commit Message

Stefan Schulze Frielinghaus via Binutils March 20, 2020, 2:08 a.m.
* metag-dis.c (print_insn_metag): Don't ignore status from
	read_memory_func.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/opcodes/metag-dis.c b/opcodes/metag-dis.c
index f01dcbaef1..b1cf6331b5 100644
--- a/opcodes/metag-dis.c
+++ b/opcodes/metag-dis.c
@@ -3364,9 +3364,15 @@  print_insn_metag (bfd_vma pc, disassemble_info *outf)
   bfd_byte buf[4];
   unsigned int insn_word;
   size_t i;
-  outf->bytes_per_chunk = 4;
+  int status;
 
-  (*outf->read_memory_func) (pc & ~0x03, buf, 4, outf);
+  outf->bytes_per_chunk = 4;
+  status = (*outf->read_memory_func) (pc & ~0x03, buf, 4, outf);
+  if (status)
+    {
+      (*outf->memory_error_func) (status, pc, outf);
+      return -1;
+    }
   insn_word = bfd_getl32 (buf);
 
   for (i = 0; i < sizeof(metag_optab)/sizeof(metag_optab[0]); i++)