com php-src: Prevent memcmp() result truncation This fixes reported issues with sapi/phpdbg/tests/watch_001.phpt: sapi/phpdb g/phpdbg_watch.c

From: Date: Fri, 23 Oct 2015 08:37:15 +0000
Subject: com php-src: Prevent memcmp() result truncation This fixes reported issues with sapi/phpdbg/tests/watch_001.phpt: sapi/phpdb g/phpdbg_watch.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89519@lists.php.net to get a copy of this message
Commit: 959d93086a1f51bd256123cec4bbad5d4c84a94f Author: Bob Weinand <bobwei9@hotmail.com> Tue, 13 Oct 2015 15:51:23 +0200 Committer: Anatol Belski <ab@php.net> Fri, 23 Oct 2015 10:37:15 +0200 Parents: 8d5904f10f28b17855e3f62fd317b13474883c2e Branches: PHP-7.0.0 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=959d93086a1f51bd256123cec4bbad5d4c84a94f Log: Prevent memcmp() result truncation This fixes reported issues with sapi/phpdbg/tests/watch_001.phpt Changed paths: M sapi/phpdbg/phpdbg_watch.c Diff: diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c index 06a0bbe...4cf3acb 100644 --- a/sapi/phpdbg/phpdbg_watch.c +++ b/sapi/phpdbg/phpdbg_watch.c @@ -964,7 +964,7 @@ static void phpdbg_print_changed_zval(phpdbg_watch_memdump *dump) { switch (watch->type) { case WATCH_ON_ZVAL: - do_break = memcmp(oldPtr, watch->addr.zv, sizeof(zend_value) + sizeof(uint32_t) /* value + typeinfo */); + do_break = memcmp(oldPtr, watch->addr.zv, sizeof(zend_value) + sizeof(uint32_t) /* value + typeinfo */) != 0; if (!do_break) { goto end; } @@ -976,7 +976,7 @@ static void phpdbg_print_changed_zval(phpdbg_watch_memdump *dump) { } break; case WATCH_ON_REFCOUNTED: - do_break = memcmp(oldPtr, watch->addr.ref, sizeof(uint32_t) /* no zend_refcounted metadata info */); + do_break = memcmp(oldPtr, watch->addr.ref, sizeof(uint32_t) /* no zend_refcounted metadata info */) != 0; if (!do_break) { goto end; } @@ -999,7 +999,7 @@ static void phpdbg_print_changed_zval(phpdbg_watch_memdump *dump) { switch (watch->type) { case WATCH_ON_ZVAL: { - int show_value = memcmp(oldPtr, watch->addr.zv, sizeof(zend_value) + sizeof(uint32_t) /* no metadata info */); + zend_bool show_value = memcmp(oldPtr, watch->addr.zv, sizeof(zend_value) + sizeof(uint32_t) /* no metadata info */) != 0; if ((watch->flags & PHPDBG_WATCH_NORMAL) && (removed || show_value)) { /* TODO: Merge with refcounting watches, store if watched ref value is to be dropped etc. [for example: manually increment refcount transparently for displaying and drop it if it decrements to 1] */

« previous php.cvs (#89519) next »