new file mode 100644
@@ -0,0 +1,40 @@
+From 016bd2b384ed34185a1770312124ceca0086d7a8 Mon Sep 17 00:00:00 2001
+From: Robert Rothenberg <perl@rhizomnic.com>
+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
+
+Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
+
+Signed-off-by: Robert Rothenberg <rrwo@cpansec.org>
+
+CVE: CVE-2026-14740
+Upstream-Status: Backport [https://github.com/perl5-dbi/dbi/commit/fc16f9e8b3dd5c65caf1867781ab2bfe2fadcc01]
+
+(cherry picked from commit fc16f9e8b3dd5c65caf1867781ab2bfe2fadcc01)
+Signed-off-by: Hetvi Thakar <hthakar@cisco.com>
+---
+ DBI.xs | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/DBI.xs b/DBI.xs
+index 23ad34a..f40c17a 100644
+--- a/DBI.xs
++++ b/DBI.xs
+@@ -4237,7 +4237,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';
+ }
@@ -18,6 +18,7 @@ SRC_URI = "http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-${PV}.tar.gz \
file://CVE-2026-14380_p3.patch \
file://CVE-2026-14380_p4.patch \
file://CVE-2026-14739.patch \
+ file://CVE-2026-14740.patch \
"
SRC_URI[md5sum] = "352f80b1e23769c116082a90905d7398"
SRC_URI[sha256sum] = "8a2b993db560a2c373c174ee976a51027dd780ec766ae17620c20393d2e836fa"