Blame SOURCES/libarchive-3.1.2-CVE-2016-4302.patch

995285
From 05caadc7eedbef471ac9610809ba683f0c698700 Mon Sep 17 00:00:00 2001
995285
From: Tim Kientzle <kientzle@acm.org>
995285
Date: Sun, 19 Jun 2016 14:21:42 -0700
995285
Subject: [PATCH] Issue 719:  Fix for TALOS-CAN-154
995285
995285
A RAR file with an invalid zero dictionary size was not being
995285
rejected, leading to a zero-sized allocation for the dictionary
995285
storage which was then overwritten during the dictionary initialization.
995285
995285
Thanks to the Open Source and Threat Intelligence project at Cisco for
995285
reporting this.
995285
---
995285
 libarchive/archive_read_support_format_rar.c | 6 ++++++
995285
 1 file changed, 6 insertions(+)
995285
995285
diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c
995285
index 6450aac..6c49f1a 100644
995285
--- a/libarchive/archive_read_support_format_rar.c
995285
+++ b/libarchive/archive_read_support_format_rar.c
995285
@@ -2127,6 +2127,12 @@ parse_codes(struct archive_read *a)
995285
       rar->range_dec.Stream = &rar->bytein;
995285
       __archive_ppmd7_functions.Ppmd7_Construct(&rar->ppmd7_context);
995285
 
995285
+      if (rar->dictionary_size == 0) {
995285
+	      archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
995285
+                          "Invalid zero dictionary size");
995285
+	      return (ARCHIVE_FATAL);
995285
+      }
995285
+
995285
       if (!__archive_ppmd7_functions.Ppmd7_Alloc(&rar->ppmd7_context,
995285
         rar->dictionary_size, &g_szalloc))
995285
       {
995285
-- 
995285
2.7.4
995285