1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Fix memory leak when calloc() fails in php_readline_completion_cb()
This commit is contained in:
Niels Dossche
2025-05-24 20:39:38 +02:00
2 changed files with 6 additions and 1 deletions

4
NEWS
View File

@@ -12,6 +12,10 @@ PHP NEWS
- Phar: - Phar:
. Add missing filter cleanups on phar failure. (nielsdos) . Add missing filter cleanups on phar failure. (nielsdos)
- Readline:
. Fix memory leak when calloc() fails in php_readline_completion_cb().
(nielsdos)
- SimpleXML: - SimpleXML:
. Fixed bug GH-18597 (Heap-buffer-overflow in zend_alloc.c when assigning . Fixed bug GH-18597 (Heap-buffer-overflow in zend_alloc.c when assigning
string with UTF-8 bytes). (nielsdos) string with UTF-8 bytes). (nielsdos)

View File

@@ -473,13 +473,14 @@ char **php_readline_completion_cb(const char *text, int start, int end)
/* libedit will read matches[2] */ /* libedit will read matches[2] */
matches = calloc(3, sizeof(char *)); matches = calloc(3, sizeof(char *));
if (!matches) { if (!matches) {
return NULL; goto out;
} }
matches[0] = strdup(""); matches[0] = strdup("");
} }
} }
} }
out:
zval_ptr_dtor(&params[0]); zval_ptr_dtor(&params[0]);
zval_ptr_dtor(&_readline_array); zval_ptr_dtor(&_readline_array);