aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2005-06-24 22:04:11 +0000
committerTom Tromey <tromey@gcc.gnu.org>2005-06-24 22:04:11 +0000
commit6a05987083f4bb8812017baa0e3a134d21a4095e (patch)
tree2fb0ce960f2580cd478fa4ee956b309b7890e938 /libjava
parent011646f5ef1722cfe07463256378bf7ffd0b1710 (diff)
downloadgcc-6a05987083f4bb8812017baa0e3a134d21a4095e.zip
gcc-6a05987083f4bb8812017baa0e3a134d21a4095e.tar.gz
gcc-6a05987083f4bb8812017baa0e3a134d21a4095e.tar.bz2
interpret.cc (compile): Handle case where table entry is outside of PC range.
* interpret.cc (compile): Handle case where table entry is outside of PC range. From-SVN: r101298
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog5
-rw-r--r--libjava/interpret.cc6
2 files changed, 10 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index c81a79b..af57bb6 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,8 @@
+2005-06-24 Tom Tromey <tromey@redhat.com>
+
+ * interpret.cc (compile): Handle case where table entry is
+ outside of PC range.
+
2005-06-23 Bryce McKinlay <mckinlay@redhat.com>
* testsuite/libjava.compile/PR20697.java: New test-case.
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index e7d8992..355b5b9 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]];
}