blob: 481da06a7f78e90ee4d603f29f7d2919fde9eaac (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
From 382a08fa0b21d46c44c46af39041324f304a9dfa Mon Sep 17 00:00:00 2001
From: Aaron Klotz <aklotz@mozilla.com>
Date: Tue, 13 Oct 2015 12:20:25 -0600
Subject: [PATCH] Bug 1211262: Ensure that STORED entries in ZIP are considered
corrupt if compressed and uncompressed sizes differ; r=mwu, a=ritu
--HG--
extra : source : 673d9f45b802f1fd1ffaaeae19d433622fe68a5e
extra : intermediate-source : db9d3e806685d72a2891830ffbc42ef3cde559ae
---
modules/libjar/nsZipArchive.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp
index bb1e21b..eaf22ac 100644
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -828,8 +828,10 @@ MOZ_WIN_MEM_TRY_BEGIN
// -- check if there is enough source data in the file
if (!offset ||
mFd->mLen < aItem->Size() ||
- offset > mFd->mLen - aItem->Size())
+ offset > mFd->mLen - aItem->Size() ||
+ (aItem->Compression() == STORED && aItem->Size() != aItem->RealSize())) {
return nullptr;
+ }
return mFd->mFileData + offset;
MOZ_WIN_MEM_TRY_CATCH(return nullptr)
--
2.5.0
|