Commit bfaf9a43a5cd25f683e8a42a8288f44232b72053

Authored by edgar_igl
1 parent 5c751e99

Teach the CRIS disassembler to stay within the provided buffer.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4353 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 6 deletions
cris-dis.c
... ... @@ -2625,12 +2625,10 @@ print_insn_cris_generic (bfd_vma memaddr,
2625 2625 If we can't get any data, or we do not get enough data, we print
2626 2626 the error message. */
2627 2627  
2628   - for (nbytes = MAX_BYTES_PER_CRIS_INSN; nbytes > 0; nbytes -= 2)
2629   - {
2630   - status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);
2631   - if (status == 0)
2632   - break;
2633   - }
  2628 + nbytes = info->buffer_length;
  2629 + if (nbytes > MAX_BYTES_PER_CRIS_INSN)
  2630 + nbytes = MAX_BYTES_PER_CRIS_INSN;
  2631 + status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);
2634 2632  
2635 2633 /* If we did not get all we asked for, then clear the rest.
2636 2634 Hopefully this makes a reproducible result in case of errors. */
... ...