* Verify that the "cookie" is a DEX file we opened.
*
* Expects that the hash table will be *unlocked* here.
+ *
+ * If the cookie is invalid, we throw an exception and return "false".
*/
static bool validateCookie(int cookie)
{
void* result = dvmHashTableLookup(gDvm.userDexFiles, hash, pDexOrJar,
hashcmpDexOrJar, false);
dvmHashTableUnlock(gDvm.userDexFiles);
- if (result == NULL)
+ if (result == NULL) {
+ dvmThrowException("Ljava/lang/RuntimeException;",
+ "invalid DexFile cookie");
return false;
+ }
return true;
}
LOGV("Closing DEX file %p (%s)\n", pDexOrJar, pDexOrJar->fileName);
if (!validateCookie(cookie))
- dvmAbort();
+ RETURN_VOID();
/*
* We can't just free arbitrary DEX files because they have bits and
free(name);
if (!validateCookie(cookie))
- dvmAbort();
+ RETURN_VOID();
if (pDexOrJar->isDex)
pDvmDex = dvmGetRawDexFileDex(pDexOrJar->pRawDexFile);
ArrayObject* stringArray;
if (!validateCookie(cookie))
- dvmAbort();
+ RETURN_VOID();
if (pDexOrJar->isDex)
pDvmDex = dvmGetRawDexFileDex(pDexOrJar->pRawDexFile);