public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Remi Collet <remi@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/php-extras] eln: Fix Integer overflow in the dblib/firebird quoter causing OOB writes
Date: Wed, 28 Oct 2026 15:08:54 GMT [thread overview]
Message-ID: <179320013434.1.8964194107525957020.rpms-php-extras-c8db9002cc98@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/php-extras
Branch : eln
Commit : c8db9002cc98214125b72fc89dbf74d97a509720
Author : Remi Collet <remi@fedoraproject.org>
Date : 2024-11-29T07:47:56+01:00
Stats : +126/-7 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/php-extras/c/c8db9002cc98214125b72fc89dbf74d97a509720?branch=eln
Log:
Fix Integer overflow in the dblib/firebird quoter causing OOB writes
CVE-2024-11236
enable pdo_dblib extension
---
diff --git a/.gitignore b/.gitignore
index acc5dd9..afe0795 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,3 @@
clog
-/php-8.0.13.tar.xz
-/php-8.0.20.tar.xz
-/php-8.0.30.tar.xz
+/php-8.0.*.tar.xz
/php-8.3.12.tar.xz
diff --git a/php-cve-2024-11236.patch b/php-cve-2024-11236.patch
new file mode 100644
index 0000000..a9bef04
--- /dev/null
+++ b/php-cve-2024-11236.patch
@@ -0,0 +1,111 @@
+From e20734c704acb87728feadf97fb10a21f006f88a Mon Sep 17 00:00:00 2001
+From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
+Date: Thu, 24 Oct 2024 22:02:17 +0200
+Subject: [PATCH] Fix GHSA-5hqh-c84r-qjcv: Integer overflow in the dblib quoter
+ causing OOB writes
+
+---
+ ext/pdo_dblib/dblib_driver.c | 10 ++++++--
+ ext/pdo_dblib/tests/GHSA-5hqh-c84r-qjcv.phpt | 24 ++++++++++++++++++++
+ 2 files changed, 32 insertions(+), 2 deletions(-)
+ create mode 100644 ext/pdo_dblib/tests/GHSA-5hqh-c84r-qjcv.phpt
+
+diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c
+index 02ec2466a05fb..d7620307aa85b 100644
+--- a/ext/pdo_dblib/dblib_driver.c
++++ b/ext/pdo_dblib/dblib_driver.c
+@@ -148,7 +148,7 @@ static zend_string* dblib_handle_quoter(pdo_dbh_t *dbh, const zend_string *unquo
+ bool use_national_character_set = 0;
+ size_t i;
+ char *q;
+- size_t quotedlen = 0;
++ size_t quotedlen = 0, extralen = 0;
+ zend_string *quoted_str;
+
+ if (H->assume_national_character_set_strings) {
+@@ -163,7 +163,7 @@ static zend_string* dblib_handle_quoter(pdo_dbh_t *dbh, const zend_string *unquo
+
+ /* Detect quoted length, adding extra char for doubled single quotes */
+ for (i = 0; i < ZSTR_LEN(unquoted); i++) {
+- if (ZSTR_VAL(unquoted)[i] == '\'') ++quotedlen;
++ if (ZSTR_VAL(unquoted)[i] == '\'') ++extralen;
+ ++quotedlen;
+ }
+
+@@ -171,6 +171,12 @@ static zend_string* dblib_handle_quoter(pdo_dbh_t *dbh, const zend_string *unquo
+ if (use_national_character_set) {
+ ++quotedlen; /* N prefix */
+ }
++
++ if (UNEXPECTED(quotedlen > ZSTR_MAX_LEN - extralen)) {
++ return NULL;
++ }
++
++ quotedlen += extralen;
+ quoted_str = zend_string_alloc(quotedlen, 0);
+ q = ZSTR_VAL(quoted_str);
+ if (use_national_character_set) {
+diff --git a/ext/pdo_dblib/tests/GHSA-5hqh-c84r-qjcv.phpt b/ext/pdo_dblib/tests/GHSA-5hqh-c84r-qjcv.phpt
+new file mode 100644
+index 0000000000000..431c61951ee2a
+--- /dev/null
++++ b/ext/pdo_dblib/tests/GHSA-5hqh-c84r-qjcv.phpt
+@@ -0,0 +1,24 @@
++--TEST--
++GHSA-5hqh-c84r-qjcv (Integer overflow in the dblib quoter causing OOB writes)
++--EXTENSIONS--
++pdo_dblib
++--SKIPIF--
++<?php
++if (PHP_INT_SIZE != 4) die("skip for 32bit platforms only");
++if (PHP_OS_FAMILY === "Windows") die("skip not for Windows because the virtual address space for application is only 2GiB");
++if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
++require __DIR__ . '/config.inc';
++getDbConnection();
++?>
++--INI--
++memory_limit=-1
++--FILE--
++<?php
++
++require __DIR__ . '/config.inc';
++$db = getDbConnection();
++var_dump($db->quote(str_repeat("'", 2147483646)));
++
++?>
++--EXPECT--
++bool(false)
+From 2518ec1118dfc4dd10826bd26a8b7d51f4f8c538 Mon Sep 17 00:00:00 2001
+From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
+Date: Thu, 24 Oct 2024 22:02:36 +0200
+Subject: [PATCH] Fix GHSA-5hqh-c84r-qjcv: Integer overflow in the firebird
+ quoter causing OOB writes
+
+---
+ ext/pdo_firebird/firebird_driver.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c
+index e570b684c5a4b..4f8cd83d7b8ab 100644
+--- a/ext/pdo_firebird/firebird_driver.c
++++ b/ext/pdo_firebird/firebird_driver.c
+@@ -664,7 +664,7 @@ static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const zend_string *sql) /*
+ /* called by the PDO SQL parser to add quotes to values that are copied into SQL */
+ static zend_string* firebird_handle_quoter(pdo_dbh_t *dbh, const zend_string *unquoted, enum pdo_param_type paramtype)
+ {
+- int qcount = 0;
++ size_t qcount = 0;
+ char const *co, *l, *r;
+ char *c;
+ size_t quotedlen;
+@@ -678,6 +678,10 @@ static zend_string* firebird_handle_quoter(pdo_dbh_t *dbh, const zend_string *un
+ /* count the number of ' characters */
+ for (co = ZSTR_VAL(unquoted); (co = strchr(co,'\'')); qcount++, co++);
+
++ if (UNEXPECTED(ZSTR_LEN(unquoted) + 2 > ZSTR_MAX_LEN - qcount)) {
++ return NULL;
++ }
++
+ quotedlen = ZSTR_LEN(unquoted) + qcount + 2;
+ quoted_str = zend_string_alloc(quotedlen, 0);
+ c = ZSTR_VAL(quoted_str);
diff --git a/php-extras.spec b/php-extras.spec
index 58fe515..ac9e31f 100644
--- a/php-extras.spec
+++ b/php-extras.spec
@@ -4,11 +4,10 @@
%bcond_without sodium
%bcond_without tidy
%bcond_without aspell
+%bcond_without freetds
# Disabled as dependencies not available
%bcond_with imap
-# https://bugzilla.redhat.com/2319127 - Please branch and build freetds for EPEL 10
-%bcond_with freetds
# https://bugzilla.redhat.com/2319128 - Please branch and build firebird for EPEL 10
%bcond_with firebird
@@ -16,11 +15,15 @@
Name: php-extras
Summary: Additional PHP extensions from the standard PHP distribution
Version: 8.3.12
-Release: 2%{?dist}
-License: PHP
+Release: 3%{?dist}
+License: PHP-3.01
URL: https://www.php.net/
Source0: https://www.php.net/distributions/php-%{version}.tar.xz
+# Security patches
+# From 8.3.14
+Patch100: php-cve-2024-11236.patch
+
BuildRequires: (php-devel >= 8.3 with php-devel < 8.4)
BuildRequires: php-pdo
@@ -139,6 +142,8 @@ low-level PHP extension for the libsodium cryptographic library.
%prep
%setup -q -n php-%{version}
+%patch -P100 -p1 -b .cve11236
+
%build
for mod in \
@@ -308,6 +313,11 @@ done
%endif
%changelog
+* Fri Nov 29 2024 Remi Collet <rcollet@redhat.com> - 8.3.12-3
+- Fix Integer overflow in the dblib/firebird quoter causing OOB writes
+ CVE-2024-11236
+- enable pdo_dblib extension
+
* Wed Oct 16 2024 Remi Collet <rcollet@redhat.com> - 8.3.12-2
- enable pspell extension
reply other threads:[~2026-10-28 15:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179320013434.1.8964194107525957020.rpms-php-extras-c8db9002cc98@fedoraproject.org \
--to=remi@fedoraproject.org \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox