зеркало из https://github.com/mozilla/gecko-dev.git
Bug 524313: crash [@ RaiseException ] nsFastLoadFileReader::ReadFooter r=brendan
--HG-- extra : rebase_source : d9f2f41d0c2dfc0e7a2d90c97789e66a38c3f43f
This commit is contained in:
Родитель
8bd123a021
Коммит
3ee5c41dde
|
@ -778,29 +778,6 @@ nsXULPrototypeCache::StartFastLoad(nsIURI* aURI)
|
|||
rv = fastLoadService->NewInputStream(file, getter_AddRefs(objectInput));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (gChecksumXULFastLoadFile) {
|
||||
nsCOMPtr<nsIFastLoadReadControl>
|
||||
readControl(do_QueryInterface(objectInput));
|
||||
if (readControl) {
|
||||
// Verify checksum, using the fastLoadService's checksum
|
||||
// cache to avoid computing more than once per session.
|
||||
PRUint32 checksum;
|
||||
rv = readControl->GetChecksum(&checksum);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 verified;
|
||||
rv = fastLoadService->ComputeChecksum(file,
|
||||
readControl,
|
||||
&verified);
|
||||
if (NS_SUCCEEDED(rv) && verified != checksum) {
|
||||
#ifdef DEBUG
|
||||
printf("bad FastLoad file checksum\n");
|
||||
#endif
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Get the XUL fastload file version number, which should be
|
||||
// decremented whenever the XUL-specific file format changes
|
||||
|
|
|
@ -959,23 +959,6 @@ mozJSComponentLoader::StartFastLoad(nsIFastLoadService *flSvc)
|
|||
|
||||
nsCOMPtr<nsIFastLoadReadControl>
|
||||
readControl(do_QueryInterface(mFastLoadInput));
|
||||
if (readControl) {
|
||||
// Verify checksum, using the FastLoadService's
|
||||
// checksum cache to avoid computing more than once
|
||||
// per session.
|
||||
PRUint32 checksum;
|
||||
rv = readControl->GetChecksum(&checksum);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 verified;
|
||||
rv = flSvc->ComputeChecksum(mFastLoadFile,
|
||||
readControl, &verified);
|
||||
if (NS_SUCCEEDED(rv) && verified != checksum) {
|
||||
LOG(("Incorrect checksum detected"));
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
/* Get the JS bytecode version number and validate it. */
|
||||
PRUint32 version;
|
||||
|
|
|
@ -887,6 +887,14 @@ nsFastLoadFileReader::Open()
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PRUint32 checksum;
|
||||
rv = ComputeChecksum(&checksum);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (checksum != mHeader.mChecksum)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (mHeader.mVersion != MFL_FILE_VERSION ||
|
||||
mHeader.mFooterOffset == 0 ||
|
||||
memcmp(mHeader.mMagic, magic, MFL_FILE_MAGIC_SIZE))
|
||||
|
|
Загрузка…
Ссылка в новой задаче