diff options
author | Bas Schouten <bschouten@mozilla.com> | 2020-05-05 23:22:19 +0000 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-05-06 19:15:42 +0200 |
commit | 276e70d35dc0b7d4f2541361d0e537d7a3751883 (patch) | |
tree | 13707426f7ef32074cf43bdbef3a3b47c00950f3 /modules | |
parent | 167e63c55266c6cab39f03b6ddfd2b30c0728b4c (diff) | |
download | uxp-276e70d35dc0b7d4f2541361d0e537d7a3751883.tar.gz |
Prevent the existance of dangling pointers upon failure of FindDataStart.
Diffstat (limited to 'modules')
-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 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; } |