filter InnerClasses attribute for relevant classes in JVM_GetDeclaredClasses

The InnerClasses attribute may have entries for classes declared
inside classes we don't care about, so we must check each entry's
outer class reference and make sure it matches the one we do care
about.
This commit is contained in:
Joel Dice 2013-04-22 21:20:21 -06:00
parent 63ee3ab0a2
commit e3fe9099a2

View File

@ -4448,7 +4448,10 @@ jvmGetDeclaredClasses(Thread* t, uintptr_t* arguments)
unsigned count = 0;
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
if (innerClassReferenceOuter(t, arrayBody(t, table, i))) {
object outer = innerClassReferenceOuter(t, arrayBody(t, table, i));
if (outer and byteArrayEqual
(t, outer, className(t, jclassVmClass(t, *c))))
{
++ count;
}
}
@ -4457,7 +4460,10 @@ jvmGetDeclaredClasses(Thread* t, uintptr_t* arguments)
PROTECT(t, result);
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
if (innerClassReferenceOuter(t, arrayBody(t, table, i))) {
object outer = innerClassReferenceOuter(t, arrayBody(t, table, i));
if (outer and byteArrayEqual
(t, outer, className(t, jclassVmClass(t, *c))))
{
object inner = getJClass
(t, resolveClass
(t, classLoader(t, jclassVmClass(t, *c)),