Skip to contentSkip to conversation

[4353] Teach the CRIS disassembler to stay within the provided buffer.

Qemu-devel Edgar E. Iglesias 1 participant 1 message May 6, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 4353

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4353
Author:   edgar_igl
Date:     2008-05-06 08:45:10 +0000 (Tue, 06 May 2008)

Log Message:
-----------
Teach the CRIS disassembler to stay within the provided buffer.

Modified Paths:
--------------
trunk/cris-dis.c

Modified: trunk/cris-dis.c
===================================================================

cris-dis.c +4 -6
@@ -2625,12 +2625,10 @@
      If we can't get any data, or we do not get enough data, we print
      the error message.  */
 
-  for (nbytes = MAX_BYTES_PER_CRIS_INSN; nbytes > 0; nbytes -= 2)
-    {
-      status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);
-      if (status == 0)
-	break;
-    }
+  nbytes = info->buffer_length;
+  if (nbytes > MAX_BYTES_PER_CRIS_INSN)
+	  nbytes = MAX_BYTES_PER_CRIS_INSN;
+  status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);  
 
   /* If we did not get all we asked for, then clear the rest.
      Hopefully this makes a reproducible result in case of errors.  */