summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBas Schouten <bschouten@mozilla.com>2020-05-05 23:22:19 +0000
committerMoonchild <moonchild@palemoon.org>2020-05-05 23:22:19 +0000
commitb378ddaace9e745e9b4a856eb06679e5e8fa07f5 (patch)
treeb1cae4fa73a5a2ccf5ddd457f256f24d752a824d /modules
parent518efb215a8b24205df712c07101fedbad56f194 (diff)
downloaduxp-b378ddaace9e745e9b4a856eb06679e5e8fa07f5.tar.gz
Prevent the existance of dangling pointers upon failure of FindDataStart.
Diffstat (limited to 'modules')
-rw-r--r--modules/libjar/nsZipArchive.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp
index 841503ebf3..2f12af5f0c 100644
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -217,16 +217,17 @@ nsresult nsZipHandle::Init(nsIFile *file, nsZipHandle **ret,
#else
handle->mNSPRFileDesc = fd.forget();
#endif
- handle->mMap = map;
handle->mFile.Init(file);
handle->mTotalLen = (uint32_t) size;
handle->mFileStart = buf;
rv = handle->findDataStart();
if (NS_FAILED(rv)) {
PR_MemUnmap(buf, (uint32_t) size);
+ handle->mFileStart = nullptr;
PR_CloseFileMap(map);
return rv;
}
+ handle->mMap = map;
handle.forget(ret);
return NS_OK;
}