php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68712 suspicious if-else statements
Submitted: 2015-01-02 07:28 UTC Modified: 2016-07-23 17:32 UTC
From: bugreports at internot dot info Assigned: cmb (profile)
Status: Closed Package: GD related
PHP Version: master-Git-2015-01-02 (Git) OS: Linux Ubuntu 14.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugreports at internot dot info
New email:
PHP Version: OS:

 

 [2015-01-02 07:28 UTC] bugreports at internot dot info
Description:
------------
Hi,

in /ext/gd/libgd/gd_interpolation.c:

1539                        if (m >= src_h - 2) {
1540                                src_offset_x[13] = n;
1541                                src_offset_y[13] = m;
1542                        } else {
1543                                src_offset_x[13] = n;
1544                                src_offset_y[13] = m;
1545                        }


and

1946                                if (m < 1) {
1947                                        src_offset_x[1] = n;
1948                                        src_offset_y[1] = m;
1949                                } else {
1950                                        src_offset_x[1] = n;
1951                                        src_offset_y[1] = m ;
1952                                }



In each, each possiblity is the same. Is this intended?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-08 08:44 UTC] laruence@php.net
-Assigned To: +Assigned To: pajoye
 [2016-07-23 17:15 UTC] cmb@php.net
-Summary: identical code +Summary: superfluous if-else statements
 [2016-07-23 17:32 UTC] cmb@php.net
-Summary: superfluous if-else statements +Summary: suspicious if-else statements -Status: Assigned +Status: Verified -Assigned To: pajoye +Assigned To: cmb
 [2016-07-23 17:32 UTC] cmb@php.net
> In each, each possiblity is the same. Is this intended?

Comparing with external libgd, it is indeed. Therefore the
if-statements are superfluous and should be removed to avoid
confusion.
 [2016-07-23 17:51 UTC] cmb@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=88838dd28200b53c4da7a558975b195fd41ba446
Log: Fix #68712: suspicious if-else statements
 [2016-07-23 17:51 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2016-10-17 10:10 UTC] bwoebi@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=88838dd28200b53c4da7a558975b195fd41ba446
Log: Fix #68712: suspicious if-else statements
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Feb 03 18:01:32 2025 UTC