libdbi-perl: Fix CVE-2026-9698
PATCH 1/5 libdbi-perl: Fix CVE-2026-9698
From: Hetvi Thakar <[email protected]>
This patch applies the upstream fix as referenced in [2], using the commit shown in [1].
[1] https://github.com/perl5-dbi/dbi/commit/bfe5d73c162d2d1f761a639a0aa33aad6a9eb54e
[2] https://nvd.nist.gov/vuln/detail/CVE-2026-9698
--- .../perl/libdbi-perl/CVE-2026-9698.patch | 51 +++++++++++++++++++ .../perl/libdbi-perl_1.647.bb | 4 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-devtools/perl/libdbi-perl/CVE-2026-9698.patch
meta-oe/recipes-devtools/perl/libdbi-perl/CVE-2026-9698.patch new file +51 -0
@@ -0,0 +1,51 @@ +From 9a85c9bc1c1fafa42a223d3310f9c5a6305902f0 Mon Sep 17 00:00:00 2001 +From: "H.Merijn Brand - Tux" <[email protected]> +Date: Wed, 27 May 2026 11:16:50 +0200 +Subject: [PATCH] Fix possible stack overflow (old issue already noted by Tim) + +CVE: CVE-2026-9698 +Upstream-Status: Backport [https://github.com/perl5-dbi/dbi/commit/bfe5d73c162d2d1f761a639a0aa33aad6a9eb54e] + +Backport Changes: +- Applied the DBI.xs security fix without functional changes. +- Omitted ChangeLog and lib/DBI/Changes.pm because they contain only + DBI 1.648 release-note updates. +- Omitted dbixs_rev.h because it is generated from upstream Git history + and its hunk depends on DBIXS_RELEASE and DBIXS_VERSION metadata added + after DBI 1.647. The fix does not change the DBIXS or DBISTATE + interface. +- Omitted the Makefile.PL addition that runs dbixs_rev.pl from the doc + target. It only regenerates dbixs_rev.h and is not required to compile + or activate the DBI.xs security fix. + +(cherry picked from commit bfe5d73c162d2d1f761a639a0aa33aad6a9eb54e) +Signed-off-by: Hetvi Thakar <[email protected]> +--- + DBI.xs | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/DBI.xs b/DBI.xs +index 97d9378..1f06d4d 100644 +--- a/DBI.xs ++++ b/DBI.xs +@@ -4000,7 +4000,6 @@ XS(XS_DBI_dispatch) + SV **statement_svp = NULL; + const int is_warning = (!SvTRUE(err_sv) && strlen(SvPV_nolen(err_sv))==1); + const char *err_meth_name = meth_name; +- char intro[200]; + + if (meth_type == methtype_set_err) { + SV **sem_svp = hv_fetch((HV*)SvRV(h), "dbi_set_err_method", 18, GV_ADDWARN); +@@ -4008,10 +4007,8 @@ XS(XS_DBI_dispatch) + err_meth_name = SvPV_nolen(*sem_svp); + } + +- /* XXX change to vsprintf into sv directly */ +- sprintf(intro,"%s %s %s: ", HvNAME(DBIc_IMP_STASH(imp_xxh)), err_meth_name, +- SvTRUE(err_sv) ? "failed" : is_warning ? "warning" : "information"); +- msg = sv_2mortal(newSVpv(intro,0)); ++ msg = sv_2mortal(newSVpvf("%s %s %s: ", HvNAME(DBIc_IMP_STASH(imp_xxh)), err_meth_name, ++ SvTRUE(err_sv) ? "failed" : is_warning ? "warning" : "information")); + if (SvOK(DBIc_ERRSTR(imp_xxh))) + sv_catsv(msg, DBIc_ERRSTR(imp_xxh)); + else
meta-oe/recipes-devtools/perl/libdbi-perl_1.647.bb +3 -1
@@ -9,7 +9,9 @@ SECTION = "libs" LICENSE = "Artistic-1.0 | GPL-1.0-or-later" LIC_FILES_CHKSUM = "file://LICENSE;md5=65f65488c774efe1da488e36ad6c4a36" -SRC_URI = "${CPAN_MIRROR}/authors/id/H/HM/HMBRAND/DBI-${PV}.tgz" +SRC_URI = "${CPAN_MIRROR}/authors/id/H/HM/HMBRAND/DBI-${PV}.tgz \ + file://CVE-2026-9698.patch \ + " SRC_URI[sha256sum] = "0df16af8e5b3225a68b7b592ab531004ddb35a9682b50300ce50174ad867d9aa" S = "${UNPACKDIR}/DBI-${PV}"
Signature · 1 line
2.35.6
PATCH 2/5 libdbi-perl: Fix CVE-2026-10879
From: Hetvi Thakar <[email protected]>
This patch applies the upstream fix as referenced in [2], using the commit shown in [1].
[1] https://github.com/perl5-dbi/dbi/commit/af79036c07aa9a457971c0f4136e37c85dc20978
[2] https://security-tracker.debian.org/tracker/CVE-2026-10879
--- .../perl/libdbi-perl/CVE-2026-10879.patch | 41 +++++++++++++++++++ .../perl/libdbi-perl_1.647.bb | 1 + 2 files changed, 42 insertions(+) create mode 100644 meta-oe/recipes-devtools/perl/libdbi-perl/CVE-2026-10879.patch
meta-oe/recipes-devtools/perl/libdbi-perl/CVE-2026-10879.patch new file +41 -0
@@ -0,0 +1,41 @@ +From 37f2f9149944fa265ea65a8344a9efcdebc0d717 Mon Sep 17 00:00:00 2001 +From: "H.Merijn Brand - Tux" <[email protected]> +Date: Thu, 28 May 2026 14:14:50 +0200 +Subject: [PATCH] Replacing `?` with `:p#` in `preparse ()` with more than 9 + `?` causes buffer overflow + +`:p1` is length 3, `?` just 1, but `:p1003` is length 6! + +CVE: CVE-2026-10879 +Upstream-Status: Backport [https://github.com/perl5-dbi/dbi/commit/af79036c07aa9a457971c0f4136e37c85dc20978] + +Backport Changes: +- Applied the DBI.xs security fix without functional changes. +- Omitted ChangeLog and lib/DBI/Changes.pm because they contain only + DBI 1.648 release-note updates. +- Omitted dbixs_rev.h because it is generated from upstream Git history + and its hunk only updates the generated timestamp and revision. The + fix does not change the DBIXS or DBISTATE interface. +- Omitted doc/DBI.3 and doc/DBI.man because they are generated manual + pages that only contain regenerated dates and are absent from the + DBI 1.647 CPAN source. + +(cherry picked from commit af79036c07aa9a457971c0f4136e37c85dc20978) +Signed-off-by: Hetvi Thakar <[email protected]> +--- + DBI.xs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/DBI.xs b/DBI.xs +index 1f06d4d..fbfe405 100644 +--- a/DBI.xs ++++ b/DBI.xs +@@ -4203,7 +4203,7 @@ preparse(SV *dbh, const char *statement, IV ps_return, IV ps_accept, void *foo) + } + + /* XXX this allocation strategy won't work when we get to more advanced stuff */ +- new_stmt_sv = newSV(strlen(statement) * 3); ++ new_stmt_sv = newSV(strlen(statement) * 6 + 16); + sv_setpv(new_stmt_sv,""); + src = statement; + dest = SvPVX(new_stmt_sv);
meta-oe/recipes-devtools/perl/libdbi-perl_1.647.bb +1 -0
@@ -11,6 +11,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=65f65488c774efe1da488e36ad6c4a36" SRC_URI = "${CPAN_MIRROR}/authors/id/H/HM/HMBRAND/DBI-${PV}.tgz \ file://CVE-2026-9698.patch \ + file://CVE-2026-10879.patch \ " SRC_URI[sha256sum] = "0df16af8e5b3225a68b7b592ab531004ddb35a9682b50300ce50174ad867d9aa"
Signature · 1 line
2.35.6
PATCH 3/5 libdbi-perl: Fix CVE-2026-14380
In reply to Hetvi Thakar -X (hthakar - E INFOCHIPS PRIVATE LIMITED at Cisco)From: Hetvi Thakar <[email protected]>
This patch applies the upstream fix as referenced in [2], using the commit shown in [1].
The upstream fix replaces a string eval used to load profile packages with Module::Load::load. Since Perl core modules are packaged separately, add perl-module-load to RDEPENDS to provide Module/Load.pm at runtime.
[1] https://github.com/perl5-dbi/dbi/commit/b73d5d9901767fc1d16b6661ef08fbed4532e259
[2] https://nvd.nist.gov/vuln/detail/CVE-2026-14380
--- .../perl/libdbi-perl/CVE-2026-14380.patch | 37 +++++++++++++++++++ .../perl/libdbi-perl_1.647.bb | 2 + 2 files changed, 39 insertions(+) create mode 100644 meta-oe/recipes-devtools/perl/libdbi-perl/CVE-2026-14380.patch
meta-oe/recipes-devtools/perl/libdbi-perl/CVE-2026-14380.patch new file +37 -0
@@ -0,0 +1,37 @@ +From 509bbfcff36b1b1e1d81cc3ca435974448b9835c Mon Sep 17 00:00:00 2001 +From: Robert Rothenberg <[email protected]> +Date: Wed, 1 Jul 2026 22:31:56 +0100 +Subject: [PATCH] Load profile packages using Module::Load [CVE-2026-14380] + +CVE: CVE-2026-14380 +Upstream-Status: Backport [https://github.com/perl5-dbi/dbi/commit/b73d5d9901767fc1d16b6661ef08fbed4532e259] + +(cherry picked from commit b73d5d9901767fc1d16b6661ef08fbed4532e259) +Signed-off-by: Hetvi Thakar <[email protected]> +--- + lib/DBI/Profile.pm | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/lib/DBI/Profile.pm b/lib/DBI/Profile.pm +index 9b16c53..66f39ec 100644 +--- a/lib/DBI/Profile.pm ++++ b/lib/DBI/Profile.pm +@@ -679,6 +679,7 @@ use warnings; + use Exporter (); + use UNIVERSAL (); + use Carp; ++use Module::Load (); + + use DBI qw(dbi_time dbi_profile dbi_profile_merge_nodes dbi_profile_merge); + +@@ -758,7 +759,9 @@ sub _auto_new { + } + } + +- eval "require $package" if $package; # silently ignores errors ++ eval { ++ Module::Load::load $package if $package; # silently ignores errors ++ }; + $package ||= $class; + + return $package->new(Path => \@Path, @args);
meta-oe/recipes-devtools/perl/libdbi-perl_1.647.bb +2 -0
@@ -12,6 +12,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=65f65488c774efe1da488e36ad6c4a36" SRC_URI = "${CPAN_MIRROR}/authors/id/H/HM/HMBRAND/DBI-${PV}.tgz \ file://CVE-2026-9698.patch \ file://CVE-2026-10879.patch \ + file://CVE-2026-14380.patch \ " SRC_URI[sha256sum] = "0df16af8e5b3225a68b7b592ab531004ddb35a9682b50300ce50174ad867d9aa"
@@ -41,6 +42,7 @@ RDEPENDS:${PN}:class-target = " \ perl-module-exporter-heavy \ perl-module-dynaloader \ perl-module-io-dir \ + perl-module-load \ perl-module-scalar-util \ perl-module-universal \ "
Signature · 1 line
2.35.6
PATCH 4/5 libdbi-perl: Fix CVE-2026-14739
In reply to Hetvi Thakar -X (hthakar - E INFOCHIPS PRIVATE LIMITED at Cisco)From: Hetvi Thakar <[email protected]>
This patch applies the upstream fix as referenced in [2], using the commit shown in [1].
[1] https://github.com/perl5-dbi/dbi/commit/2b77c88b655e9539a592c71a61fb965fc0075395
[2] https://nvd.nist.gov/vuln/detail/CVE-2026-14739
--- .../perl/libdbi-perl/CVE-2026-14739.patch | 124 ++++++++++++++++++ .../perl/libdbi-perl_1.647.bb | 1 + 2 files changed, 125 insertions(+) create mode 100644 meta-oe/recipes-devtools/perl/libdbi-perl/CVE-2026-14739.patch
meta-oe/recipes-devtools/perl/libdbi-perl/CVE-2026-14739.patch new file +124 -0
@@ -0,0 +1,124 @@ +From 99798054e18bc9653ce0e29b2de90288981b4ad4 Mon Sep 17 00:00:00 2001 +From: "H.Merijn Brand - Tux" <[email protected]> +Date: Sat, 4 Jul 2026 11:38:24 +0200 +Subject: [PATCH] Set a hard limit of 99999 on '?' placeholders + (CVE-2026-14739) + +CVE: CVE-2026-14739 +Upstream-Status: Backport [https://github.com/perl5-dbi/dbi/commit/2b77c88b655e9539a592c71a61fb965fc0075395] + +Backport Changes: +- Applied the complete DBI.xs security fix without functional changes. + This patch follows CVE-2026-10879 because the upstream fix updates + that earlier fix's buffer allocation and adds the 99,999-placeholder + limit. +- Omitted ChangeLog and lib/DBI/Changes.pm because they contain only + DBI 1.650 release-note updates. +- Omitted dbixs_rev.h because it is generated from upstream Git history. + The fix does not change the DBIXS or DBISTATE interface. +- Omitted DBI.pm because its upstream hunks only bump the package from + 1.649 to 1.650 and document the new placeholder limit; they do not + compile or activate the DBI.xs security fix. +- Omitted generated doc/DBI.3, doc/DBI.html, doc/DBI.man, and doc/DBI.md + because they only reproduce the DBI.pm version and documentation + changes and are absent from the DBI 1.647 CPAN source. + +(cherry picked from commit 2b77c88b655e9539a592c71a61fb965fc0075395) +Signed-off-by: Hetvi Thakar <[email protected]> +--- + DBI.xs | 53 +++++++++++++++++++++++++++++++++-------------------- + 1 file changed, 33 insertions(+), 20 deletions(-) + +diff --git a/DBI.xs b/DBI.xs +index fbfe405..0f9ea9c 100644 +--- a/DBI.xs ++++ b/DBI.xs +@@ -4203,7 +4203,14 @@ preparse(SV *dbh, const char *statement, IV ps_return, IV ps_accept, void *foo) + } + + /* XXX this allocation strategy won't work when we get to more advanced stuff */ +- new_stmt_sv = newSV(strlen(statement) * 6 + 16); ++ /* The 7 is for length increase from '?' (length 1) to :p99999 (length 7) ++ * which imposes a limit of 99999 '?' placeholders POSIX style. Actual counts ++ * are a bit higher: ++ * using factor 5: :p1 .. :p1107 ++ * using factor 6: :p1 .. :p11106 ++ * using factor 7: :p1 .. :p111105 ++ * and that count is insane already */ ++ new_stmt_sv = newSV(strlen(statement) * 7 + 16); + sv_setpv(new_stmt_sv,""); + src = statement; + dest = SvPVX(new_stmt_sv); +@@ -4342,9 +4349,9 @@ preparse(SV *dbh, const char *statement, IV ps_return, IV ps_accept, void *foo) + continue; + } + +- if ( !(*src==':' && (PS_accept(DBIpp_ph_cn) || PS_accept(DBIpp_ph_cs))) +- && !(*src=='?' && PS_accept(DBIpp_ph_qm)) +- ){ ++ if ( !(*src==':' && (PS_accept(DBIpp_ph_cn) || PS_accept(DBIpp_ph_cs))) ++ && !(*src=='?' && PS_accept(DBIpp_ph_qm)) ++ ){ + if (*src == '\'' || *src == '"') + in_quote = *src; + *dest++ = *src++; +@@ -4363,12 +4370,18 @@ preparse(SV *dbh, const char *statement, IV ps_return, IV ps_accept, void *foo) + if (PS_return(DBIpp_ph_qm)) + ; + else if (PS_return(DBIpp_ph_cn)) { /* '?' -> ':p1' (etc) */ ++ if (idx >= 99999) { ++ char buf[99]; ++ sprintf(buf, "preparse found more than 99999 '?' placeholders. Limit exceeded."); ++ set_err_char(dbh, imp_xxh, "1", 1, buf, 0, "preparse"); ++ return &PL_sv_undef; ++ } + sprintf(start,":p%d", idx++); + dest = start+strlen(start); + } + else if (PS_return(DBIpp_ph_sp)) { /* '?' -> '%s' */ +- *start = '%'; +- *dest++ = 's'; ++ *start = '%'; ++ *dest++ = 's'; + } + } + else if (isDIGIT(*src)) { /* :1 */ +@@ -4376,24 +4389,24 @@ preparse(SV *dbh, const char *statement, IV ps_return, IV ps_accept, void *foo) + style = ":1"; + + if (PS_return(DBIpp_ph_cn)) { /* ':1'->':p1' */ +- idx = pln; +- *dest++ = 'p'; +- while(isDIGIT(*src)) +- *dest++ = *src++; ++ idx = pln; ++ *dest++ = 'p'; ++ while(isDIGIT(*src)) ++ *dest++ = *src++; + } + else if (PS_return(DBIpp_ph_qm) /* ':1' -> '?' */ + || PS_return(DBIpp_ph_sp) /* ':1' -> '%s' */ + ) { +- PS_return(DBIpp_ph_qm) ? sprintf(start,"?") : sprintf(start,"%%s"); +- dest = start + strlen(start); +- if (pln != idx) { +- char buf[99]; +- sprintf(buf, "preparse found placeholder :%d out of sequence, expected :%d", pln, idx); +- set_err_char(dbh, imp_xxh, "1", 1, buf, 0, "preparse"); +- return &PL_sv_undef; +- } +- while(isDIGIT(*src)) src++; +- idx++; ++ PS_return(DBIpp_ph_qm) ? sprintf(start,"?") : sprintf(start,"%%s"); ++ dest = start + strlen(start); ++ if (pln != idx) { ++ char buf[99]; ++ sprintf(buf, "preparse found placeholder :%d out of sequence, expected :%d", pln, idx); ++ set_err_char(dbh, imp_xxh, "1", 1, buf, 0, "preparse"); ++ return &PL_sv_undef; ++ } ++ while(isDIGIT(*src)) src++; ++ idx++; + } + } + else if (isALNUM(*src)) /* :name */
meta-oe/recipes-devtools/perl/libdbi-perl_1.647.bb +1 -0
@@ -13,6 +13,7 @@ SRC_URI = "${CPAN_MIRROR}/authors/id/H/HM/HMBRAND/DBI-${PV}.tgz \ file://CVE-2026-9698.patch \ file://CVE-2026-10879.patch \ file://CVE-2026-14380.patch \ + file://CVE-2026-14739.patch \ " SRC_URI[sha256sum] = "0df16af8e5b3225a68b7b592ab531004ddb35a9682b50300ce50174ad867d9aa"
Signature · 1 line
2.35.6
PATCH 5/5 libdbi-perl: Fix CVE-2026-14740
In reply to Hetvi Thakar -X (hthakar - E INFOCHIPS PRIVATE LIMITED at Cisco)From: Hetvi Thakar <[email protected]>
This patch applies the upstream fix as referenced in [2], using the commit shown in [1].
[1] https://github.com/perl5-dbi/dbi/commit/fc16f9e8b3dd5c65caf1867781ab2bfe2fadcc01
[2] https://nvd.nist.gov/vuln/detail/CVE-2026-14740
--- .../perl/libdbi-perl/CVE-2026-14740.patch | 39 +++++++++++++++++++ .../perl/libdbi-perl_1.647.bb | 1 + 2 files changed, 40 insertions(+) create mode 100644 meta-oe/recipes-devtools/perl/libdbi-perl/CVE-2026-14740.patch
meta-oe/recipes-devtools/perl/libdbi-perl/CVE-2026-14740.patch new file +39 -0
@@ -0,0 +1,39 @@ +From 65a5eecd6845ed1c29ede9bbe0b651fa3ba3cc2d Mon Sep 17 00:00:00 2001 +From: Robert Rothenberg <[email protected]> +Date: Sat, 4 Jul 2026 10:49:42 +0100 +Subject: [PATCH] Fix out-of-bounds read in preparse when an initial comment is + deleted + +This fixes CVE-2026-14740 + +CVE: CVE-2026-14740 +Upstream-Status: Backport [https://github.com/perl5-dbi/dbi/commit/fc16f9e8b3dd5c65caf1867781ab2bfe2fadcc01] + +Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> + +Signed-off-by: Robert Rothenberg <[email protected]> +(cherry picked from commit fc16f9e8b3dd5c65caf1867781ab2bfe2fadcc01) +Signed-off-by: Hetvi Thakar <[email protected]> +--- + DBI.xs | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/DBI.xs b/DBI.xs +index 0f9ea9c..da5d137 100644 +--- a/DBI.xs ++++ b/DBI.xs +@@ -4239,7 +4239,13 @@ preparse(SV *dbh, const char *statement, IV ps_return, IV ps_accept, void *foo) + } + if (in_comment == '/') + src++; +- src += (*src != '\n' || *(dest-1)=='\n') ? 1 : 0; ++ /* Only inspect the previously-emitted byte if one exists; ++ when an initial line comment is deleted, dest is still at ++ the start of the output buffer and *(dest-1) would read ++ one byte before it (OOB read). */ ++ src += (*src != '\n' ++ || (dest > SvPVX(new_stmt_sv) && *(dest-1)=='\n')) ++ ? 1 : 0; + in_comment = '\0'; + rt_comment = '\0'; + }
meta-oe/recipes-devtools/perl/libdbi-perl_1.647.bb +1 -0
@@ -14,6 +14,7 @@ SRC_URI = "${CPAN_MIRROR}/authors/id/H/HM/HMBRAND/DBI-${PV}.tgz \ file://CVE-2026-10879.patch \ file://CVE-2026-14380.patch \ file://CVE-2026-14739.patch \ + file://CVE-2026-14740.patch \ " SRC_URI[sha256sum] = "0df16af8e5b3225a68b7b592ab531004ddb35a9682b50300ce50174ad867d9aa"
Signature · 1 line
2.35.6