From 272c92178a38e6a207a4b292301867dcdb294c36 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 8 Dec 2005 15:21:05 +0000 Subject: [PATCH] opcodes/ 2005-12-08 Jan Beulich * i386-dis.c (MAXLEN): Reduce to architectural limit. (fetch_data): Check for sufficient buffer size. --- opcodes/ChangeLog | 5 +++++ opcodes/i386-dis.c | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 6b2961eb402..d4a2b41ab05 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2005-12-08 Jan Beulich + + * i386-dis.c (MAXLEN): Reduce to architectural limit. + (fetch_data): Check for sufficient buffer size. + 2005-12-08 Jan Beulich * i386-dis.c (OP_ST): Remove prefix in Intel mode. diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 32293a81026..973682bde21 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -35,7 +35,7 @@ #include "sysdep.h" #include "opintl.h" -#define MAXLEN 20 +#define MAXLEN 15 #include @@ -179,10 +179,13 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr) struct dis_private *priv = (struct dis_private *) info->private_data; bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer); - status = (*info->read_memory_func) (start, - priv->max_fetched, - addr - priv->max_fetched, - info); + if (addr <= priv->the_buffer + MAXLEN) + status = (*info->read_memory_func) (start, + priv->max_fetched, + addr - priv->max_fetched, + info); + else + status = -1; if (status != 0) { /* If we did manage to read at least one byte, then -- 2.30.2