Permalink
Browse files

filter InnerClasses attribute for relevant classes in JVM_GetDeclared…

…Classes

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.
  • Loading branch information...
1 parent 63ee3ab commit e3fe9099a2329c3ed380ac38a426944fda79aed8 @dicej dicej committed Apr 23, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/classpath-openjdk.cpp
View
@@ -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)),

0 comments on commit e3fe909

Please sign in to comment.