php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68888 Useless Code
Submitted: 2015-01-22 14:37 UTC Modified: 2015-01-22 14:50 UTC
From: bugreports at internot dot info Assigned:
Status: Not a bug Package: *General Issues
PHP Version: master-Git-2015-01-22 (Git) OS: Linux Ubuntu 14.04
Private report: No CVE-ID: None
 [2015-01-22 14:37 UTC] bugreports at internot dot info
Description:
------------
Hi,

In Zend/zend_operators.c:


        if (UNEXPECTED((zend_ulong)op2_lval >= SIZEOF_ZEND_LONG * 8)) {
                if (EXPECTED(op2_lval > 0)) {
                        ZVAL_LONG(result, 0);
                        return SUCCESS;
                } else {

If "op2_lval >= SIZEOF_ZEND_LONG * 8" is true, then "op2_lval > 0" will always be true, no?


Thanks,


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-22 14:50 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2015-01-22 14:50 UTC] nikic@php.net
Nope, because of the (zend_ulong) cast. The condition effectively checks if op2_lval is negative OR greater than the maximum shift width.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC