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

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