Skip to content

Commit

Permalink
Merge pull request #3974 from pdbain-ibm/classloader
Browse files Browse the repository at this point in the history
Check arity of array classes
  • Loading branch information
DanHeidinga committed Dec 11, 2018
2 parents 8b5be51 + 3ab55fc commit 1fc149f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions runtime/vm/classsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ internalFindArrayClass(J9VMThread* vmThread, J9Module *j9module, UDATA arity, U_

vmThread->privateFlags &= ~J9_PRIVATE_FLAGS_CLOAD_NO_MEM;

if (arity > 255) {
goto done;
}

if (length > arity) {
firstChar = name[arity];
lastChar = name[length-1];
Expand All @@ -112,7 +116,7 @@ internalFindArrayClass(J9VMThread* vmThread, J9Module *j9module, UDATA arity, U_
arrayClass = internalFindClassInModule(vmThread, j9module, name, length, classLoader, options);

} else {
return NULL;
goto done;
}

while (arrayClass && arity-- > 0) {
Expand All @@ -128,7 +132,7 @@ internalFindArrayClass(J9VMThread* vmThread, J9Module *j9module, UDATA arity, U_
}
}
}

done:
return arrayClass;
}

Expand All @@ -147,12 +151,11 @@ calculateArity(J9VMThread* vmThread, U_8* name, UDATA length)
{
U_32 arity = 0;

while (length > 0 && *name == '[') {
while ((length > 0) && ('[' == *name)) {
name += 1;
length -= 1;
arity += 1;
}

return arity;
}

Expand Down

0 comments on commit 1fc149f

Please sign in to comment.