summaryrefslogtreecommitdiff
path: root/libjava/interpret.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-24 22:04:11 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-24 22:04:11 +0000
commit0e26cf9911087616a1506c0613ce9498d2bf0507 (patch)
tree2fb0ce960f2580cd478fa4ee956b309b7890e938 /libjava/interpret.cc
parent141b8d909ece3d6a01f9d8c6c2b69a33948ab0b0 (diff)
downloadgcc-0e26cf9911087616a1506c0613ce9498d2bf0507.tar.gz
* interpret.cc (compile): Handle case where table entry is
outside of PC range. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101298 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/interpret.cc')
-rw-r--r--libjava/interpret.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index e7d8992f12c..355b5b9054a 100644
--- a/libjava/interpret.cc
+++ b/libjava/interpret.cc
@@ -1,6 +1,6 @@
// interpret.cc - Code for the interpreter
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation
This file is part of libgcj.
@@ -763,6 +763,10 @@ _Jv_InterpMethod::compile (const void * const *insn_targets)
for (int i = 0; i < line_table_len; i++)
{
int byte_pc = line_table[i].bytecode_pc;
+ // It isn't worth throwing an exception if this table is
+ // corrupted, but at the same time we don't want a crash.
+ if (byte_pc < 0 || byte_pc >= code_length)
+ byte_pc = 0;
line_table[i].pc = &insns[pc_mapping[byte_pc]];
}