From 88838dd28200b53c4da7a558975b195fd41ba446 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sat, 23 Jul 2016 19:29:43 +0200 Subject: [PATCH] Fix #68712: suspicious if-else statements --- NEWS | 1 + ext/gd/libgd/gd_interpolation.c | 36 ++++++++------------------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/NEWS b/NEWS index b3000bd745876..6fe4d5c78b0a1 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,7 @@ PHP NEWS . Fixed bug #43828 (broken transparency of imagearc for truecolor in blendingmode). (cmb) . Fixed bug #66555 (Always false condition in ext/gd/libgd/gdkanji.c). (cmb) + . Fixed bug #68712 (suspicious if-else statements). (cmb) - Intl: . Partially fixed #72506 (idn_to_ascii for UTS #46 incorrect for long domain diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index 833e7fc093b7b..4c11213a8eb71 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -1509,13 +1509,8 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co src_offset_y[0] = m; } - if (m < 1) { - src_offset_x[1] = n; - src_offset_y[1] = m; - } else { - src_offset_x[1] = n; - src_offset_y[1] = m; - } + src_offset_x[1] = n; + src_offset_y[1] = m; if ((m < 1) || (n >= src_w - 1)) { src_offset_x[2] = n; @@ -1567,13 +1562,8 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co src_offset_y[8] = m; } - if (m >= src_h - 1) { - src_offset_x[9] = n; - src_offset_y[9] = m; - } else { - src_offset_x[9] = n; - src_offset_y[9] = m; - } + src_offset_x[9] = n; + src_offset_y[9] = m; if ((m >= src_h-1) || (n >= src_w-1)) { src_offset_x[10] = n; @@ -1599,13 +1589,8 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co src_offset_y[12] = m; } - if (m >= src_h - 2) { - src_offset_x[13] = n; - src_offset_y[13] = m; - } else { - src_offset_x[13] = n; - src_offset_y[13] = m; - } + src_offset_x[13] = n; + src_offset_y[13] = m; if ((m >= src_h - 2) || (n >= src_w - 1)) { src_offset_x[14] = n; @@ -2014,13 +1999,8 @@ gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const src_offset_y[0] = m; } - if (m < 1) { - src_offset_x[1] = n; - src_offset_y[1] = m; - } else { - src_offset_x[1] = n; - src_offset_y[1] = m ; - } + src_offset_x[1] = n; + src_offset_y[1] = m; if ((m < 1) || (n >= src_w-1)) { src_offset_x[2] = - 1;