diff options
author | Bas Schouten <bschouten@mozilla.com> | 2020-05-05 23:22:19 +0000 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-05-06 19:02:28 +0200 |
commit | 6afd96c4602b611993f7c6128f29ea59a104992f (patch) | |
tree | e50a0960a00fb82eed5f520cf7f3823e47186794 | |
parent | 9858dc03cb6755412a0f4e5ee96ba21b5b669ea1 (diff) | |
download | UXP-6afd96c4602b611993f7c6128f29ea59a104992f.tar UXP-6afd96c4602b611993f7c6128f29ea59a104992f.tar.gz UXP-6afd96c4602b611993f7c6128f29ea59a104992f.tar.lz UXP-6afd96c4602b611993f7c6128f29ea59a104992f.tar.xz UXP-6afd96c4602b611993f7c6128f29ea59a104992f.zip |
Prevent the existance of dangling pointers upon failure of FindDataStart.
-rw-r--r-- | modules/libjar/nsZipArchive.cpp | 3 |
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; } |