summaryrefslogtreecommitdiff
path: root/opcodes/dis-buf.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-03-23 15:59:44 +0000
committerJoseph Myers <joseph@codesourcery.com>2010-03-23 15:59:44 +0000
commita58d0307cac7e74366a611c1f345f0cf7bf625c9 (patch)
tree5c3dac655506dde2fa6eb4c82005b9688a82f5f9 /opcodes/dis-buf.c
parente2105229a851b702e91a509c1cb0266390bc3320 (diff)
downloadbinutils-redhat-a58d0307cac7e74366a611c1f345f0cf7bf625c9.tar.gz
* dis-buf.c (buffer_read_memory): Give error for reading just
before the start of memory.
Diffstat (limited to 'opcodes/dis-buf.c')
-rw-r--r--opcodes/dis-buf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/opcodes/dis-buf.c b/opcodes/dis-buf.c
index 7e3fd63a88..372fb96b28 100644
--- a/opcodes/dis-buf.c
+++ b/opcodes/dis-buf.c
@@ -1,6 +1,6 @@
/* Disassemble from a buffer, for GNU.
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.
@@ -38,6 +38,7 @@ buffer_read_memory (bfd_vma memaddr,
unsigned int octets = (memaddr - info->buffer_vma) * opb;
if (memaddr < info->buffer_vma
+ || memaddr - info->buffer_vma > max_addr_offset
|| memaddr - info->buffer_vma + end_addr_offset > max_addr_offset)
/* Out of bounds. Use EIO because GDB uses it. */
return EIO;