]> granicus.if.org Git - php/commitdiff
Fixed bug #75139 (libgd/gd_interpolation.c:1786: suspicious if ?)
authorChristoph M. Becker <cmbecker69@gmx.de>
Fri, 1 Sep 2017 22:04:02 +0000 (00:04 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Fri, 1 Sep 2017 22:04:02 +0000 (00:04 +0200)
We back-port https://github.com/libgd/libgd/commit/dd48286 even though
we cannot come up with a regression test, because the erroneous
condition appears to be impossible to trigger.

We also parenthesize the inner ternary operation to avoid confusion.

NEWS
ext/gd/libgd/gd_interpolation.c

diff --git a/NEWS b/NEWS
index bd93282df50923c12a1e1549bbc0a15de275c63c..09b0307aba90b44f6d9ac9d1d09304901df1457d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ PHP                                                                        NEWS
 
 - GD:
   . Fixed bug #75124 (gdImageGrayScale() may produce colors). (cmb)
+  . Fixed bug #75139 (libgd/gd_interpolation.c:1786: suspicious if ?). (cmb)
 
 - Intl:
   . Fixed bug #75090 (IntlGregorianCalendar doesn't have constants from parent
index 1c151b55090d4225eae1b32df406e67d6f07f7e8..4446ec772bef6e884c71aafc939985da0cfc7b64 100644 (file)
@@ -1783,8 +1783,8 @@ gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int b
 
        const gdFixed f_slop_y = f_sin;
        const gdFixed f_slop_x = f_cos;
-       const gdFixed f_slop = f_slop_x > 0 && f_slop_x > 0 ?
-                                                       f_slop_x > f_slop_y ? gd_divfx(f_slop_y, f_slop_x) : gd_divfx(f_slop_x, f_slop_y)
+       const gdFixed f_slop = f_slop_x > 0 && f_slop_y > 0 ?
+                                                       (f_slop_x > f_slop_y ? gd_divfx(f_slop_y, f_slop_x) : gd_divfx(f_slop_x, f_slop_y))
                                                : 0;