Add security patches for PHP 7.4.33.

Raw patches from omega8cc/boa (5.x-dev, aegir/patches/php-sec):

  php-7.4.33-cve-2026-109618-109619.patch
  php-7.4.33-sury-31.patch
  php-7.4.33-xlts-1.patch
  php-7.4.33-xlts-2.patch

php-7.4.33-sury-31-re2c-generated.patch (own patch) applies the
pdo_sql_parser.re and url_scanner_ex.re hunks of sury-31 to the
generated *.c files, so the fixes are built without re2c.
(ext/date/lib/parse_iso_intervals.c already contains the fix of the
parse_iso_intervals.re hunk.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrisandClaude Opus 5.5 committed 2026-11-20 18:47:37 +01:00
1 parent f19ee454d1
commit 6a3b03fd9f
5 files changed
+19833

No files matched your search

+100
View File
@@ -0,0 +1,100 @@
diff --git a/ext/mysqli/tests/mysqlnd_row_decode_failure_refetch.phpt b/ext/mysqli/tests/mysqlnd_row_decode_failure_refetch.phpt
new file mode 100644
index 00000000..12ce0b0b
--- /dev/null
+++ b/ext/mysqli/tests/mysqlnd_row_decode_failure_refetch.phpt
@@ -0,0 +1,34 @@
+--TEST--
+mysqlnd: a row whose decoding failed is decoded again, never served from freed fields
+--EXTENSIONS--
+mysqli
+--FILE--
+<?php
+require_once 'fake_server.inc';
+
+$port = 33305;
+$process = run_fake_server_in_background('stmt_response_row_over_read_int', $port);
+$process->wait();
+
+$conn = new mysqli("127.0.0.1", "root", "", "", $port);
+$stmt = $conn->prepare("SELECT strval, intval FROM data");
+$stmt->execute();
+$result = $stmt->get_result();
+
+$first = @$result->fetch_assoc();
+var_dump($first);
+$result->data_seek(0);
+$second = @$result->fetch_assoc();
+var_dump($second);
+
+$result->free();
+$stmt->close();
+$conn->close();
+$process->terminate(true);
+print "done!";
+?>
+--EXPECTF--
+%A
+bool(false)
+bool(false)
+%Adone!%A
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
index 75dbe5e4..4a7fe087 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@ -1605,6 +1605,8 @@ php_mysqlnd_rowp_read_binary_protocol(MYSQLND_ROW_BUFFER * row_buffer, zval * fi
if (rbs <= row_position) {
for (j = 0, current_field = start_field; j < i; current_field++, j++) {
zval_ptr_dtor(current_field);
+ /* the caller keeps this array and frees it again later */
+ ZVAL_UNDEF(current_field);
}
php_error_docref(NULL, E_WARNING, "Malformed server packet. No packet space left for the field");
DBG_RETURN(FAIL);
@@ -1613,6 +1615,8 @@ php_mysqlnd_rowp_read_binary_protocol(MYSQLND_ROW_BUFFER * row_buffer, zval * fi
if (p == NULL) {
for (j = 0, current_field = start_field; j < i; current_field++, j++) {
zval_ptr_dtor(current_field);
+ /* the caller keeps this array and frees it again later */
+ ZVAL_UNDEF(current_field);
}
DBG_RETURN(FAIL);
}
@@ -1697,6 +1701,8 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_ROW_BUFFER * row_buffer, zval *
php_error_docref(NULL, E_WARNING, "Malformed server packet. Field length pointing after end of packet");
for (j = 0, current_field = start_field; j < i; current_field++, j++) {
zval_ptr_dtor(current_field);
+ /* the caller keeps this array and frees it again later */
+ ZVAL_UNDEF(current_field);
}
DBG_RETURN(FAIL);
} else {
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 2ea81763..b4634c64 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -517,13 +517,8 @@ static int sapi_cli_server_startup(sapi_module_struct *sapi_module) /* {{{ */
if (php_cli_server_workers_max > 1) {
zend_long php_cli_server_worker;
- php_cli_server_workers = calloc(
- php_cli_server_workers_max, sizeof(pid_t));
- if (!php_cli_server_workers) {
- php_cli_server_workers_max = 1;
-
- return SUCCESS;
- }
+ php_cli_server_workers = pecalloc(
+ php_cli_server_workers_max, sizeof(pid_t), 1);
php_cli_server_master = getpid();
@@ -2357,7 +2352,7 @@ static void php_cli_server_dtor(php_cli_server *server) /* {{{ */
!WIFSIGNALED(php_cli_server_worker_status));
}
- free(php_cli_server_workers);
+ pefree(php_cli_server_workers, 1);
}
#endif
} /* }}} */