CVE-2026-12805.patch: new: fix CVE-2026-12805.
authorÉtienne Mollier <emollier@debian.org>
Tue, 23 Jun 2026 19:42:21 +0000 (21:42 +0200)
committerÉtienne Mollier <emollier@debian.org>
Tue, 23 Jun 2026 19:42:21 +0000 (21:42 +0200)
This patch fixes a risk of buffer overflow by ensuring negative error
codes in XMLNode::parseFile are properly handled, as well a NULL
values.

Closes: #1140562
debian/patches/0019-CVE-2026-12805.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/0019-CVE-2026-12805.patch b/debian/patches/0019-CVE-2026-12805.patch
new file mode 100644 (file)
index 0000000..2cf189f
--- /dev/null
@@ -0,0 +1,34 @@
+commit 1d4b3815c0987840a983160bfc671fef63a3105b
+Author: Marco Eichelberg <eichelberg@offis.de>
+Date:   Sat May 23 17:07:58 2026 +0200
+
+    Fixed buffer overflow in XMLNode::parseFile().
+    
+    Fixed a heap buffer overflow that could occur in the XML parser
+    when reading from a named pipe.
+    
+    Thanks to Cristhian Daniel Rivas Zúñiga and Sebastian Andres Muñoz Morera
+    (Insituto Tecnológico de Costa Rica) for the bug report and fix.
+    
+    This closes DCMTK issue #1208.
+
+--- dcmtk.orig/ofstd/libsrc/ofxml.cc
++++ dcmtk/ofstd/libsrc/ofxml.cc
+@@ -1,6 +1,6 @@
+ /*
+  *
+- *  Copyright (C) 2011-2023, OFFIS e.V.
++ *  Copyright (C) 2011-2026, OFFIS e.V.
+  *  All rights reserved.  See COPYRIGHT file for details.
+  *
+  *  This software and supporting documentation were slightly modified by
+@@ -1961,7 +1961,8 @@
+     if (f==NULL) { if (pResults) pResults->error=eXMLErrorFileNotFound; return emptyXMLNode; }
+     fseek(f,0,SEEK_END);
+     int l=OFstatic_cast(int, ftell(f)),headerSz=0;
+-    if (!l) { if (pResults) pResults->error=eXMLErrorEmpty; fclose(f); return emptyXMLNode; }
++    // DCMTK: handle situation where ftell() returns -1
++    if (l <= 0) { if (pResults) pResults->error=eXMLErrorEmpty; fclose(f); return emptyXMLNode; }
+     fseek(f,0,SEEK_SET);
+     unsigned char *buf=OFreinterpret_cast(unsigned char*, malloc(l+4));
+     l=OFstatic_cast(int, fread(buf,1,l,f));
index 7313c56baa9e3627c1f7c0b110514ed8076a649e..257af226868e1a529971863c37f7ed8341600139 100644 (file)
@@ -14,3 +14,4 @@ remove_version.patch
 0016-CVE-2026-5663.patch
 0017-CVE-2025-14841.patch
 0018-CVE-2026-10194.patch
+0019-CVE-2026-12805.patch