From 340f3ac8082771ecc473ab938fc3d7cbf607ddaa Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 20 Mar 2020 10:55:58 +1030 Subject: [PATCH] metag uninitialized memory read * metag-dis.c (print_insn_metag): Don't ignore status from read_memory_func. --- opcodes/metag-dis.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/opcodes/metag-dis.c b/opcodes/metag-dis.c index f01dcba..b1cf633 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++) -- 1.8.3.1