CVE-2026-12805
authorDebian Med Packaging Team <debian-med-packaging@lists.alioth.debian.org>
Tue, 23 Jun 2026 19:44:21 +0000 (21:44 +0200)
committerÉtienne Mollier <emollier@debian.org>
Tue, 23 Jun 2026 19:44:21 +0000 (21:44 +0200)
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.

Gbp-Pq: Name 0019-CVE-2026-12805.patch

ofstd/libsrc/ofxml.cc

index c3904d29699b8e279e1a922952c47775e8af5ab8..944efbdc6ed13f7b218bea868e900b6b428ad127 100644 (file)
@@ -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 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults)
     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));