aboutsummaryrefslogtreecommitdiff
path: root/libjava/verify.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2005-09-15 22:02:13 +0000
committerTom Tromey <tromey@gcc.gnu.org>2005-09-15 22:02:13 +0000
commita022cd596984f7eb8e6189fdabab09243a217dae (patch)
tree9f425c2996ae0b146771dcc668979c48675ee708 /libjava/verify.cc
parent9026e8d4d52b13de3adcb6a165145a30f366decb (diff)
downloadgcc-a022cd596984f7eb8e6189fdabab09243a217dae.zip
gcc-a022cd596984f7eb8e6189fdabab09243a217dae.tar.gz
gcc-a022cd596984f7eb8e6189fdabab09243a217dae.tar.bz2
re PR libgcj/16032 (libgcj should reject class files with incorrect version numbers)
PR libgcj/16032: * interpret.cc (AVAL1U): Resolve pool entry when not direct threaded. (AVAL2U): Likewise. (compile): Handle 'ldc class' specially. (_Jv_InterpMethod::run): Added special 'ldc class' instruction. * verify.cc (check_constant): Handle 'ldc class' for 1.5 classes. * defineclass.cc (handleCodeAttribute): Set new field. (MAJOR_1_1, MINOR_1_1, MAJOR_1_2, MINOR_1_2, MAJOR_1_3, MINOR_1_3, MAJOR_1_4, MINOR_1_4, MAJOR_1_5, MINOR_1_5): New defines. (parse): Check version numbers. (_Jv_ClassReader::is_15): New field. (_Jv_ClassReader): Initialize it. * include/java-interp.h (_Jv_InterpMethod::is_15): New field. From-SVN: r104325
Diffstat (limited to 'libjava/verify.cc')
-rw-r--r--libjava/verify.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/libjava/verify.cc b/libjava/verify.cc
index 3869bff..8b9cfcc 100644
--- a/libjava/verify.cc
+++ b/libjava/verify.cc
@@ -1950,13 +1950,16 @@ private:
{
check_pool_index (index);
_Jv_Constants *pool = &current_class->constants;
- if (pool->tags[index] == JV_CONSTANT_ResolvedString
- || pool->tags[index] == JV_CONSTANT_String)
+ int tag = pool->tags[index];
+ if (tag == JV_CONSTANT_ResolvedString || tag == JV_CONSTANT_String)
return type (&java::lang::String::class$, this);
- else if (pool->tags[index] == JV_CONSTANT_Integer)
+ else if (tag == JV_CONSTANT_Integer)
return type (int_type);
- else if (pool->tags[index] == JV_CONSTANT_Float)
+ else if (tag == JV_CONSTANT_Float)
return type (float_type);
+ else if (current_method->is_15
+ && (tag == JV_CONSTANT_ResolvedClass || tag == JV_CONSTANT_Class))
+ return type (&java::lang::Class::class$, this);
verify_fail ("String, int, or float constant expected", start_PC);
}