summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils/opcodes
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2004-02-23 07:28:51 +0000
committerBrad Smith <brad@cvs.openbsd.org>2004-02-23 07:28:51 +0000
commit971d74304c6f7c8d620c93d801d52bdd5a7802bc (patch)
tree2c6ba8fda367e90e1ab7dd34c028f6d5434ab9e9 /gnu/usr.bin/binutils/opcodes
parent8dd789037018006b863e243c5658c72301486475 (diff)
fix a seg fault issue with objdump on sparc64.
From: binutils CVS HEAD branch, based on rev 1.8 Reported by: Daniel Lucq <daniel at lucq dot org> ok miod@
Diffstat (limited to 'gnu/usr.bin/binutils/opcodes')
-rw-r--r--gnu/usr.bin/binutils/opcodes/sparc-dis.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gnu/usr.bin/binutils/opcodes/sparc-dis.c b/gnu/usr.bin/binutils/opcodes/sparc-dis.c
index 359050723d4..444d423a4a5 100644
--- a/gnu/usr.bin/binutils/opcodes/sparc-dis.c
+++ b/gnu/usr.bin/binutils/opcodes/sparc-dis.c
@@ -682,9 +682,13 @@ print_insn_sparc (memaddr, info)
unsigned long prev_insn;
int errcode;
- errcode =
- (*info->read_memory_func)
+ if (memaddr >= 4)
+ errcode =
+ (*info->read_memory_func)
(memaddr - 4, buffer, sizeof (buffer), info);
+ else
+ errcode = 1;
+
prev_insn = getword (buffer);
if (errcode == 0)
@@ -700,8 +704,12 @@ print_insn_sparc (memaddr, info)
if (is_delayed_branch (prev_insn))
{
- errcode = (*info->read_memory_func)
- (memaddr - 8, buffer, sizeof (buffer), info);
+ if (memaddr >= 8)
+ errcode = (*info->read_memory_func)
+ (memaddr - 8, buffer, sizeof (buffer), info);
+ else
+ errcode = 1;
+
prev_insn = getword (buffer);
}
}