* dis-buf.c (buffer_read_memory): Give error for reading just

before the start of memory.
This commit is contained in:
Joseph Myers 2010-03-23 15:59:45 +00:00
parent 0aec0f3348
commit f66187fdfe
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2010-03-23 Joseph Myers <joseph@codesourcery.com>
* dis-buf.c (buffer_read_memory): Give error for reading just
before the start of memory.
2010-03-22 Sebastian Pop <sebastian.pop@amd.com> 2010-03-22 Sebastian Pop <sebastian.pop@amd.com>
Quentin Neill <quentin.neill@amd.com> Quentin Neill <quentin.neill@amd.com>

View File

@ -1,6 +1,6 @@
/* Disassemble from a buffer, for GNU. /* Disassemble from a buffer, for GNU.
Copyright 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005, Copyright 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005,
2007, 2009 Free Software Foundation, Inc. 2007, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU opcodes library. This file is part of the GNU opcodes library.
@ -38,6 +38,7 @@ buffer_read_memory (bfd_vma memaddr,
unsigned int octets = (memaddr - info->buffer_vma) * opb; unsigned int octets = (memaddr - info->buffer_vma) * opb;
if (memaddr < info->buffer_vma if (memaddr < info->buffer_vma
|| memaddr - info->buffer_vma > max_addr_offset
|| memaddr - info->buffer_vma + end_addr_offset > max_addr_offset) || memaddr - info->buffer_vma + end_addr_offset > max_addr_offset)
/* Out of bounds. Use EIO because GDB uses it. */ /* Out of bounds. Use EIO because GDB uses it. */
return EIO; return EIO;