summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorBas Schouten <bschouten@mozilla.com>2020-05-05 23:22:19 +0000
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-05-06 19:15:42 +0200
commit8b3b85854666ce1cabc25bda77f642e387ea49f6 (patch)
tree13707426f7ef32074cf43bdbef3a3b47c00950f3 /modules
parentdd506c896f9c99dbeb2d277b3da735fbd6e76761 (diff)
downloadUXP-8b3b85854666ce1cabc25bda77f642e387ea49f6.tar
UXP-8b3b85854666ce1cabc25bda77f642e387ea49f6.tar.gz
UXP-8b3b85854666ce1cabc25bda77f642e387ea49f6.tar.lz
UXP-8b3b85854666ce1cabc25bda77f642e387ea49f6.tar.xz
UXP-8b3b85854666ce1cabc25bda77f642e387ea49f6.zip
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 841503ebf..2f12af5f0 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;
}