summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-10-13 15:51:23 +0200
committerBob Weinand <bobwei9@hotmail.com>2015-10-13 15:51:23 +0200
commitd398cc9d10ac47c64ce7a462dcd65bdc3274a822 (patch)
treea995cb5257d91ba5a03149b5f2ffecac88a95b97
parent6efbfc4caf329df387c298572d56e58fe1e79d75 (diff)
downloadphp-git-d398cc9d10ac47c64ce7a462dcd65bdc3274a822.tar.gz
Prevent memcmp() result truncation
This fixes reported issues with sapi/phpdbg/tests/watch_001.phpt
-rw-r--r--sapi/phpdbg/phpdbg_watch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c
index 06a0bbefe8..4cf3acbb6c 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] */