com php-src: Fix #77800 phpdbg segfaults on conditional breakpoints: NEWS sapi/phpdbg/phpdbg_bp.c
| From: | Joe Watkins | Date: | Tue, 26 Mar 2019 22:05:06 +0000 |
| Subject: | com php-src: Fix #77800 phpdbg segfaults on conditional breakpoints: NEWS sapi/phpdbg/phpdbg_bp.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105352@lists.php.net to get a copy of this message | ||
Commit: 7df8e4fc0abc105cd5d7b933499bdd275459f7ee
Author: Joe Watkins <krakjoe@php.net> Tue, 26 Mar 2019 23:05:06 +0100
Parents: 72a2ab39ba977d542fdc33109dead3a87ea9f2ab
Branches: PHP-7.2 PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7df8e4fc0abc105cd5d7b933499bdd275459f7ee
Log:
Fix #77800 phpdbg segfaults on conditional breakpoints
Bugs:
https://bugs.php.net/77800
Changed paths:
M NEWS
M sapi/phpdbg/phpdbg_bp.c
Diff:
diff --git a/NEWS b/NEWS
index 388158c..1711079 100644
--- a/NEWS
+++ b/NEWS
@@ -12,7 +12,9 @@ PHP NEWS
- phpdbg:
. Fixed bug #76801 (too many open files). (alekitto)
-
+ . Fixed bug #77800 (phpdbg segfaults on listing some conditional breakpoints).
+ (krakjoe)
+
- Reflection:
. Fixed bug #77772 (ReflectionClass::getMethods(null) doesn't work). (Nikita)
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c
index 27bf532..56b814a 100644
--- a/sapi/phpdbg/phpdbg_bp.c
+++ b/sapi/phpdbg/phpdbg_bp.c
@@ -232,7 +232,7 @@ PHPDBG_API void phpdbg_export_breakpoints_to_string(char **str) /* {{{ */
} ZEND_HASH_FOREACH_END();
}
- if (!(*str)[0]) {
+ if ((*str) && !(*str)[0]) {
*str = NULL;
}
} /* }}} */
@@ -813,6 +813,21 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake,
co
uint32_t cops = CG(compiler_options);
zval pv;
+ switch (param->type) {
+ case STR_PARAM:
+ case NUMERIC_FUNCTION_PARAM:
+ case METHOD_PARAM:
+ case NUMERIC_METHOD_PARAM:
+ case FILE_PARAM:
+ case ADDR_PARAM:
+ /* do nothing */
+ break;
+
+ default:
+ phpdbg_error("eval", "type=\"invalidparameter\"", "Invalid
parameter type for conditional breakpoint");
+ return;
+ }
+
PHPDBG_BREAK_INIT(new_break, PHPDBG_BREAK_COND);
new_break.hash = hash;