aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/icecat-CVE-2015-2736.patch
blob: a59cc64d1089bc4f313b8e5209bbe8b2e0dd7c08 (about) (plain)
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
33
34
From 6daa986c7fdf27835a0f5d897c88f6b8dc42b8db Mon Sep 17 00:00:00 2001
From: Andrea Marchesini <amarchesini@mozilla.com>
Date: Thu, 4 Jun 2015 15:04:10 +0100
Subject: [PATCH] Bug 1167888 - Better string length check in
 nsZipArchive::BuildFileList. r=smaug, a=dveditz

--HG--
extra : transplant_source : %5E6%3E%84%B6a%7F%1F%D21zGc%BD%E1%80%EF%0C%B5%F0
---
 modules/libjar/nsZipArchive.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp
index cb3e5d0..f8af715 100644
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -617,8 +617,13 @@ MOZ_WIN_MEM_TRY_BEGIN
   if (!centralOffset)
     return NS_ERROR_FILE_CORRUPTED;
 
-  //-- Read the central directory headers
   buf = startp + centralOffset;
+
+  // avoid overflow of startp + centralOffset.
+  if (buf < startp)
+    return NS_ERROR_FILE_CORRUPTED;
+
+  //-- Read the central directory headers
   uint32_t sig = 0;
   while (buf + int32_t(sizeof(uint32_t)) <= endp &&
          (sig = xtolong(buf)) == CENTRALSIG) {
-- 
2.4.3