Bug #75139 [Asn]: php-7.1.9/ext/gd/libgd/gd_interpolation.c:1786: suspicious if ?
| From: | cmb@php.net | Date: | Thu, 31 Aug 2017 22:10:06 +0000 |
| Subject: | Bug #75139 [Asn]: php-7.1.9/ext/gd/libgd/gd_interpolation.c:1786: suspicious if ? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210901@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75139&edit=1
ID: 75139
Updated by: cmb@php.net
Reported by: dcb314 at hotmail dot com
Summary: php-7.1.9/ext/gd/libgd/gd_interpolation.c:1786:
suspicious if ?
Status: Assigned
Type: Bug
-Package: Compile Warning
+Package: GD related
Operating System: linux
PHP Version: 7.1.9RC1
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
It seems to me that is actually a bug, because
f_slop_x > 0 && f_slop_x > 0 appears to be supposed to be
f_slop_x > 0 && f_slop_y > 0 to avoid a subsequent division by
zero.
Thanks for reporting this issue!
A test exhibiting the current misbehavior would be welcome.
Previous Comments:
------------------------------------------------------------------------
[2017-08-31 07:20:55] dcb314 at hotmail dot com
Description:
------------
[php-7.1.9/ext/gd/libgd/gd_interpolation.c:1786]: (style) Same expression on both sides of
'&&'.
Source code is
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)
: 0;
BTW, using nested ternary operators is asking for trouble.
Suggest recode in a simpler way.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75139&edit=1