]> granicus.if.org Git - php/commitdiff
Fix stack leak in phpdbg
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 21 Jun 2019 14:52:08 +0000 (16:52 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 21 Jun 2019 15:01:25 +0000 (17:01 +0200)
sapi/phpdbg/phpdbg_prompt.c

index e1bfeb45da8ffeda705a77c4082f3c9243773959..248391b1883902a75e081377f29ff0ef82e979ce 100644 (file)
@@ -1632,7 +1632,14 @@ int phpdbg_interactive(zend_bool allow_async_unsafe, char *input) /* {{{ */
                                sigio_watcher_start();
                        }
 #endif
-                       switch (ret = phpdbg_stack_execute(&stack, allow_async_unsafe)) {
+                       zend_try {
+                               ret = phpdbg_stack_execute(&stack, allow_async_unsafe);
+                       } zend_catch {
+                               phpdbg_stack_free(&stack);
+                               zend_bailout();
+                       } zend_end_try();
+
+                       switch (ret) {
                                case FAILURE:
                                        if (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING)) {
                                                if (!allow_async_unsafe || phpdbg_call_register(&stack) == FAILURE) {