[php-src] PHP-8.4: Backport: fix integer overflow in to_xml_hexbin (#23771)

From: Date: Mon, 21 Sep 2026 17:55:22 +0000
Subject: [php-src] PHP-8.4: Backport: fix integer overflow in to_xml_hexbin (#23771)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141340@lists.php.net to get a copy of this message
Author: jvoisin (jvoisin) Committer: Weilin Du (LamentXU123) Date: 2026-09-22T01:53:21+08:00 Commit: https://github.com/php/php-src/commit/b03e26720b553d68d518b0ab85483afdeb11eb30 Raw diff: https://github.com/php/php-src/commit/b03e26720b553d68d518b0ab85483afdeb11eb30.diff Backport: fix integer overflow in to_xml_hexbin (#23771) Backport PR #23771 from master to PHP-8.4. Original commit: 94ddf35ca9006b0deea8f09c76308df9bf948bfd Closes #23771 Changed paths: M ext/soap/php_encoding.c Diff: diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 4eedbffc5a4b..cbdc096736db 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -996,7 +996,7 @@ static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNo ZVAL_STR(&tmp, get_serialization_string_from_zval(data)); data = &tmp; } - str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data) * 2, sizeof(char), 1); + str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data), 2, 1); for (i = j = 0; i < Z_STRLEN_P(data); i++) { str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) >> 4];

« previous php.cvs (#141340) next »