Blame SOURCES/libpng15-CVE-2018-13785.patch

8d501d
From 1748e52e41b7bd8bde8cc917053c39bd6849c17d Mon Sep 17 00:00:00 2001
8d501d
From: Cosmin Truta <ctruta@gmail.com>
8d501d
Date: Sun, 17 Jun 2018 22:56:29 -0400
8d501d
Subject: [PATCH] Fix the calculation of row_factor in png_check_chunk_length
8d501d
8d501d
(Bug report by Thuan Pham, SourceForge issue #278)
8d501d
---
8d501d
 pngrutil.c | 9 ++++++---
8d501d
 1 file changed, 6 insertions(+), 3 deletions(-)
8d501d
8d501d
diff --git a/pngrutil.c b/pngrutil.c
8d501d
index d5a344d..1e90863 100644
8d501d
--- a/pngrutil.c
8d501d
+++ b/pngrutil.c
8d501d
@@ -2839,10 +2839,13 @@ png_check_chunk_length(png_structp png_ptr, png_uint_32 length)
8d501d
    {
8d501d
       png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
8d501d
       size_t row_factor =
8d501d
-         (png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1)
8d501d
-          + 1 + (png_ptr->interlaced? 6: 0));
8d501d
+         (size_t)png_ptr->width
8d501d
+         * (size_t)png_ptr->channels
8d501d
+         * (png_ptr->bit_depth > 8? 2: 1)
8d501d
+         + 1
8d501d
+         + (png_ptr->interlaced? 6: 0);
8d501d
       if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
8d501d
-         idat_limit=PNG_UINT_31_MAX;
8d501d
+         idat_limit = PNG_UINT_31_MAX;
8d501d
       else
8d501d
          idat_limit = png_ptr->height * row_factor;
8d501d
       row_factor = row_factor > 32566? 32566 : row_factor;
8d501d
-- 
8d501d
2.17.1
8d501d