Commit 8987cc88 by Tom Tromey Committed by Tom Tromey

verify.cc (class _Jv_BytecodeVerifier): `nargs' byte is number of words, not number of arguments.

	* verify.cc (class _Jv_BytecodeVerifier) [op_invokeinterface]:
	`nargs' byte is number of words, not number of arguments.

From-SVN: r49292
parent e83cb5f0
2002-01-28 Tom Tromey <tromey@redhat.com>
* verify.cc (class _Jv_BytecodeVerifier) [op_invokeinterface]:
`nargs' byte is number of words, not number of arguments.
2002-01-27 Tom Tromey <tromey@redhat.com> 2002-01-27 Tom Tromey <tromey@redhat.com>
* java/awt/event/MouseEvent.java (modifiers): Removed field. * java/awt/event/MouseEvent.java (modifiers): Removed field.
......
...@@ -2653,16 +2653,15 @@ private: ...@@ -2653,16 +2653,15 @@ private:
opcode == op_invokeinterface, opcode == op_invokeinterface,
&method_name, &method_name,
&method_signature); &method_signature);
int arg_count = _Jv_count_arguments (method_signature); // NARGS is only used when we're processing
// invokeinterface. It is simplest for us to compute it
// here and then verify it later.
int nargs = 0;
if (opcode == op_invokeinterface) if (opcode == op_invokeinterface)
{ {
int nargs = get_byte (); nargs = get_byte ();
if (nargs == 0)
verify_fail ("too few arguments to invokeinterface");
if (get_byte () != 0) if (get_byte () != 0)
verify_fail ("invokeinterface dummy byte is wrong"); verify_fail ("invokeinterface dummy byte is wrong");
if (nargs - 1 != arg_count)
verify_fail ("wrong argument count for invokeinterface");
} }
bool is_init = false; bool is_init = false;
...@@ -2676,10 +2675,20 @@ private: ...@@ -2676,10 +2675,20 @@ private:
verify_fail ("can't invoke method starting with `<'"); verify_fail ("can't invoke method starting with `<'");
// Pop arguments and check types. // Pop arguments and check types.
int arg_count = _Jv_count_arguments (method_signature);
type arg_types[arg_count]; type arg_types[arg_count];
compute_argument_types (method_signature, arg_types); compute_argument_types (method_signature, arg_types);
for (int i = arg_count - 1; i >= 0; --i) for (int i = arg_count - 1; i >= 0; --i)
pop_type (arg_types[i]); {
// This is only used for verifying the byte for
// invokeinterface.
nargs -= arg_types[i].depth ();
pop_type (arg_types[i]);
}
if (opcode == op_invokeinterface
&& nargs != 1)
verify_fail ("wrong argument count for invokeinterface");
if (opcode != op_invokestatic) if (opcode != op_invokestatic)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment