This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/JVMTI] Implement GetLocalVariableTable and GetMaxLocals


Tom Tromey wrote:
"Kyle" == Kyle Galloway <kgallowa@redhat.com> writes:

(_Jv_AllocBytes (strlen (local_var_table[table_slot].name) + 1));
I don't see how memory allocated here can ever be freed.

Kyle> Not sure exactly what you mean here. I thought that memory allocated Kyle> with _Jv_AllocBytes is garbage collected.

Oops, I misread this.  You are correct.
Thanks.

This patch is ok.

[validation]
Kyle> The only thing that may cause a problem is if the slot values are
Kyle> invalid indicies into the variable array for that method, this is
Kyle> fairly easy to check for so i you think it's worthwhile I can add
Kyle> this.  Invalid PC values don't really matter, in my thinking, since it
Kyle> will just result in garbage values begin in the slots when the
Kyle> debugger reads them.

My concern is that invalid bytecode cannot be used to somehow attack a
debug VM. So I think somewhere we should check indices so we can
never read or write memory out of bounds..
I'm going to rework it to check that the slot is not > max_locals or < 0 to prevent against this. I'll have a new patch for you in a bit.

- Kyle


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]