opcodes/
authorJan Beulich <jbeulich@novell.com>
Thu, 8 Dec 2005 15:21:05 +0000 (15:21 +0000)
committerJan Beulich <jbeulich@novell.com>
Thu, 8 Dec 2005 15:21:05 +0000 (15:21 +0000)
2005-12-08  Jan Beulich  <jbeulich@novell.com>

* i386-dis.c (MAXLEN): Reduce to architectural limit.
(fetch_data): Check for sufficient buffer size.

opcodes/ChangeLog
opcodes/i386-dis.c

index 6b2961eb4026da0b5463c9dd11c776707e060abb..d4a2b41ab055242966e9d41fd8acae6939f4e92c 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-08  Jan Beulich  <jbeulich@novell.com>
+
+       * i386-dis.c (MAXLEN): Reduce to architectural limit.
+       (fetch_data): Check for sufficient buffer size.
+
 2005-12-08  Jan Beulich  <jbeulich@novell.com>
 
        * i386-dis.c (OP_ST): Remove prefix in Intel mode.
index 32293a810264d1a90e1d2295800c85c0767f600d..973682bde21e0a5e240575b68daaa61003275c3b 100644 (file)
@@ -35,7 +35,7 @@
 #include "sysdep.h"
 #include "opintl.h"
 
-#define MAXLEN 20
+#define MAXLEN 15
 
 #include <setjmp.h>
 
@@ -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