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

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