Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5ef0dc7
Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
bukka Apr 10, 2025
66bd809
Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
bukka Mar 4, 2025
a179e39
Fix GHSA-453j-q27h-5p8x
Lekssays Jun 3, 2025
c57ec92
Fix missing HAVE_JIT guard
iluuu1994 Jul 1, 2025
49d94cc
Merge branch 'PHP-8.4'
iluuu1994 Jul 1, 2025
927aeca
Merge branch 'PHP-8.4'
iluuu1994 Jul 1, 2025
cf0c397
Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
bukka Apr 10, 2025
545d153
Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
bukka Mar 4, 2025
dd06065
Fix GHSA-453j-q27h-5p8x
Lekssays Jun 3, 2025
fc49d33
Update NEWS with entries for security fixes
bukka Jun 26, 2025
7f5d491
Merge branch 'PHP-8.3' into PHP-8.4
ericmann Jul 1, 2025
50e1b23
Merge branch 'PHP-8.4'
ericmann Jul 1, 2025
27e67cc
Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
bukka Apr 10, 2025
a2cdff5
Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
bukka Mar 4, 2025
0298837
Fix GHSA-453j-q27h-5p8x
Lekssays Jun 3, 2025
165e516
Update NEWS with entries for security fixes
bukka Jun 26, 2025
3d8cc22
PHP-8.2 is now for PHP 8.2.30-dev
saundefined Jul 1, 2025
9174984
Fix OSS-Fuzz #427814456
ndossche Jun 26, 2025
1d5089e
Fix GH-18979: DOM\XMLDocument::createComment() triggers undefined beh…
ndossche Jun 30, 2025
30662e4
Merge branch 'PHP-8.4'
ndossche Jul 1, 2025
5d590a1
Merge branch 'PHP-8.3' into PHP-8.4
ndossche Jul 1, 2025
d706dc1
Merge branch 'PHP-8.4'
ndossche Jul 1, 2025
b576ad4
Merge branch 'PHP-8.2' into PHP-8.3
saundefined Jul 1, 2025
7a3c0d3
Merge branch 'PHP-8.3' into PHP-8.4
saundefined Jul 1, 2025
f71271d
Merge branch 'PHP-8.4'
saundefined Jul 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Zend/tests/numeric_strings/oss_fuzz_427814456.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--TEST--
OSS-Fuzz #427814456
--FILE--
<?php
set_error_handler(function(){unset($GLOBALS['x']);});
$x = str_repeat("3e33", random_int(2, 2));
$x & true;
echo "Done\n";
?>
--EXPECT--
Done
7 changes: 6 additions & 1 deletion Zend/zend_operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(const zval *
zend_long lval;
double dval;
bool trailing_data = false;
zend_string *op_str = NULL; /* protect against error handlers */

/* For BC reasons we allow errors so that we can warn on leading numeric string */
type = is_numeric_string_ex(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval,
Expand All @@ -411,6 +412,9 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(const zval *
return 0;
}
if (UNEXPECTED(trailing_data)) {
if (type != IS_LONG) {
op_str = zend_string_copy(Z_STR_P(op));
}
zend_error(E_WARNING, "A non-numeric value encountered");
if (UNEXPECTED(EG(exception))) {
*failed = 1;
Expand All @@ -426,11 +430,12 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(const zval *
*/
lval = zend_dval_to_lval_cap(dval);
if (!zend_is_long_compatible(dval, lval)) {
zend_incompatible_string_to_long_error(Z_STR_P(op));
zend_incompatible_string_to_long_error(op_str ? op_str : Z_STR_P(op));
if (UNEXPECTED(EG(exception))) {
*failed = 1;
}
}
zend_tmp_string_release(op_str);
return lval;
}
}
Expand Down
13 changes: 13 additions & 0 deletions ext/dom/tests/modern/xml/gh18979.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
GH-18979 (DOM\XMLDocument::createComment() triggers undefined behavior with null byte)
--EXTENSIONS--
dom
--FILE--
<?php
$dom = Dom\XMLDocument::createEmpty();
$container = $dom->createElement("container");
$container->append($dom->createComment("\0"));
var_dump($container->innerHTML);
?>
--EXPECT--
string(7) "<!---->"
6 changes: 5 additions & 1 deletion ext/dom/xml_serializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,11 @@ static int dom_xml_serialize_comment_node(xmlOutputBufferPtr out, xmlNodePtr com
const xmlChar *ptr = comment->content;
if (ptr != NULL) {
TRY(dom_xml_check_char_production(ptr));
if (strstr((const char *) ptr, "--") != NULL || ptr[strlen((const char *) ptr) - 1] == '-') {
if (strstr((const char *) ptr, "--") != NULL) {
return -1;
}
size_t len = strlen((const char *) ptr);
if (len > 0 && ptr[len - 1] == '-') {
return -1;
}
}
Expand Down
2 changes: 2 additions & 0 deletions ext/opcache/zend_persist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,7 @@ void zend_update_parent_ce(zend_class_entry *ce)
}
}

#ifdef HAVE_JIT
static void zend_accel_persist_jit_op_array(zend_op_array *op_array, zend_class_entry *ce)
{
if (op_array->type == ZEND_USER_FUNCTION) {
Expand Down Expand Up @@ -1315,6 +1316,7 @@ static void zend_accel_persist_link_func_info(zend_op_array *op_array, zend_clas
}
}
}
#endif

static void zend_accel_persist_class_table(HashTable *class_table)
{
Expand Down
10 changes: 9 additions & 1 deletion ext/pdo_pgsql/pgsql_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,15 @@ static zend_string* pgsql_handle_quoter(pdo_dbh_t *dbh, const zend_string *unquo
zend_string *quoted_str;
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
size_t tmp_len;
int err;

switch (paramtype) {
case PDO_PARAM_LOB:
/* escapedlen returned by PQescapeBytea() accounts for trailing 0 */
escaped = PQescapeByteaConn(H->server, (unsigned char *)ZSTR_VAL(unquoted), ZSTR_LEN(unquoted), &tmp_len);
if (escaped == NULL) {
return NULL;
}
quotedlen = tmp_len + 1;
quoted = emalloc(quotedlen + 1);
memcpy(quoted+1, escaped, quotedlen-2);
Expand All @@ -394,7 +398,11 @@ static zend_string* pgsql_handle_quoter(pdo_dbh_t *dbh, const zend_string *unquo
default:
quoted = safe_emalloc(2, ZSTR_LEN(unquoted), 3);
quoted[0] = '\'';
quotedlen = PQescapeStringConn(H->server, quoted + 1, ZSTR_VAL(unquoted), ZSTR_LEN(unquoted), NULL);
quotedlen = PQescapeStringConn(H->server, quoted + 1, ZSTR_VAL(unquoted), ZSTR_LEN(unquoted), &err);
if (err) {
efree(quoted);
return NULL;
}
quoted[quotedlen + 1] = '\'';
quoted[quotedlen + 2] = '\0';
quotedlen += 2;
Expand Down
24 changes: 24 additions & 0 deletions ext/pdo_pgsql/tests/ghsa-hrwm-9436-5mv3.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
#GHSA-hrwm-9436-5mv3: pdo_pgsql extension does not check for errors during escaping
--EXTENSIONS--
pdo
pdo_pgsql
--SKIPIF--
<?php
require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
require_once dirname(__FILE__) . '/config.inc';
PDOTest::skip();
?>
--FILE--
<?php
require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
require_once dirname(__FILE__) . '/config.inc';
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$invalid = "ABC\xff\x30';";
var_dump($db->quote($invalid));

?>
--EXPECT--
bool(false)
Loading