Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package expat for openSUSE:Factory checked 
in at 2026-11-19 16:53:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/expat (Old)
 and      /work/SRC/openSUSE:Factory/.expat.new.1251 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "expat"

Thu Nov 19 16:53:01 2026 rev:92 rq:1398192 version:2.10.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/expat/expat.changes      2026-11-03 
17:51:03.296008460 +0100
+++ /work/SRC/openSUSE:Factory/.expat.new.1251/expat.changes    2026-11-19 
16:53:05.087619574 +0100
@@ -1,0 +2,16 @@
+Tue Nov 17 11:47:19 UTC 2026 - David Anes <[email protected]>
+
+- security patches for 2.10.0:
+  * CVE-2026-124317, bsc#1290472: out-of-bounds read in the unknown
+    encoding decoder functions unknown_toUtf8 and unknown_toUtf16.
+    Upstream pull request 1492.
+    - Added patches: expat-CVE-2026-124317-01.patch,
+      expat-CVE-2026-124317-02.patch,
+      expat-CVE-2026-124317-test-reproducer.patch
+  * CVE-2026-128241, bsc#1290473: xmlwf follows a symbolic link in -d
+    output mode, and it creates output files with mode 0666. Upstream
+    pull request 1502.
+    - Added patches: expat-CVE-2026-128241-01.patch,
+      expat-CVE-2026-128241-02.patch
+
+-------------------------------------------------------------------
@@ -12 +28 @@
-    * CVE-2026-118370, bsc#1288849: protect attIndex and nPrefixes in
+    * CVE-2026-118370, bsc#1288848: protect attIndex and nPrefixes in
@@ -1550 +1565,0 @@
-

New:
----
  expat-CVE-2026-124317-01.patch
  expat-CVE-2026-124317-02.patch
  expat-CVE-2026-124317-test-reproducer.patch
  expat-CVE-2026-128241-01.patch
  expat-CVE-2026-128241-02.patch

----------(New B)----------
  New:    Upstream pull request 1492.
    - Added patches: expat-CVE-2026-124317-01.patch,
      expat-CVE-2026-124317-02.patch,
  New:    - Added patches: expat-CVE-2026-124317-01.patch,
      expat-CVE-2026-124317-02.patch,
      expat-CVE-2026-124317-test-reproducer.patch
  New:      expat-CVE-2026-124317-02.patch,
      expat-CVE-2026-124317-test-reproducer.patch
  * CVE-2026-128241, bsc#1290473: xmlwf follows a symbolic link in -d
  New:    pull request 1502.
    - Added patches: expat-CVE-2026-128241-01.patch,
      expat-CVE-2026-128241-02.patch
  New:    - Added patches: expat-CVE-2026-128241-01.patch,
      expat-CVE-2026-128241-02.patch
----------(New E)----------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ expat.spec ++++++
--- /var/tmp/diff_new_pack.G5aCN0/_old  2026-11-19 16:53:06.182665991 +0100
+++ /var/tmp/diff_new_pack.G5aCN0/_new  2026-11-19 16:53:06.183666033 +0100
@@ -33,6 +33,13 @@
 # https://www.gentoo.org/inside-gentoo/developers/index.html#sping
 # https://github.com/libexpat/libexpat/issues/537#issuecomment-1003796884
 Source4:        
https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3176ef7db2367f1fca4f306b1f9b0e909af37285#/expat.keyring
+# CVE-2026-124317 [bsc#1290472], out-of-bounds read in the unknown encoding 
decoder
+Patch0:         expat-CVE-2026-124317-01.patch
+Patch1:         expat-CVE-2026-124317-02.patch
+# CVE-2026-128241 [bsc#1290473], symlink following in xmlwf -d mode, files 
created with mode 0666
+Patch2:         expat-CVE-2026-128241-01.patch
+Patch3:         expat-CVE-2026-128241-02.patch
+Patch4:         expat-CVE-2026-124317-test-reproducer.patch
 BuildRequires:  c++_compiler
 BuildRequires:  pkgconfig
 


++++++ expat-CVE-2026-124317-01.patch ++++++
>From bf26290d2f021111cf806753dcb87d165f53571b Mon Sep 17 00:00:00 2001
From: Sebastian Pipping <[email protected]>
Date: Fri, 6 Nov 2026 19:16:22 +0100
Subject: [PATCH 1/3] lib: Resolve needless `else` in `unknown_toUtf16`

CVE-2026-124317 / bsc#1290472. Preparatory change for the fix commit
3d775676.

---
 expat/lib/xmltok.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Backport of upstream commit bf26290d2f021111cf806753dcb87d165f53571b
(pull request 1492) to expat 2.10.0. CVE-2026-124317 /
bsc#1290472. Vanilla patch, no adaptation.

diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c
index 2f837acc..f4c317f3 100644
--- expat/lib/xmltok.c
+++ expat/lib/xmltok.c
@@ -1317,8 +1317,8 @@ unknown_toUtf16(const ENCODING *enc, const char **fromP, 
const char *fromLim,
 
   if ((*toP == toLim) && (*fromP < fromLim))
     return XML_CONVERT_OUTPUT_EXHAUSTED;
-  else
-    return XML_CONVERT_COMPLETED;
+
+  return XML_CONVERT_COMPLETED;
 }
 
 ENCODING *
-- 
2.56.0


++++++ expat-CVE-2026-124317-02.patch ++++++
>From 3d77567612994172f9d09b46f31bb604e16fb08d Mon Sep 17 00:00:00 2001
From: Sebastian Pipping <[email protected]>
Date: Fri, 6 Nov 2026 18:35:50 +0100
Subject: [PATCH 2/3] lib: Reject overread in `unknown_toUtf8` and
 `unknown_toUtf16`

CVE-2026-124317 / bsc#1290472. The encoding decoder can read past the
end of the source buffer. Reject the call when the sequence length
does not fit in the buffer.

---
 expat/lib/xmltok.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Backport of upstream commit 3d77567612994172f9d09b46f31bb604e16fb08d
(pull request 1492) to expat 2.10.0. CVE-2026-124317 /
bsc#1290472. Vanilla patch, no adaptation. It applies with no offset
on the 2.10.0 source.

diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c
index f4c317f3..8cc03962 100644
--- expat/lib/xmltok.c
+++ expat/lib/xmltok.c
@@ -1283,13 +1283,17 @@ unknown_toUtf8(const ENCODING *enc, const char **fromP, 
const char *fromLim,
     utf8 = uenc->utf8[(unsigned char)**fromP];
     n = *utf8++;
     if (n == 0) {
+      const size_t readLen
+          = (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]
+             - (BT_LEAD2 - 2));
+      if (readLen > (size_t)(fromLim - *fromP))
+        return XML_CONVERT_INPUT_INCOMPLETE;
       int c = uenc->convert(uenc->userData, *fromP);
       n = XmlUtf8Encode(c, buf);
       if (n > toLim - *toP)
         return XML_CONVERT_OUTPUT_EXHAUSTED;
       utf8 = buf;
-      *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]
-                 - (BT_LEAD2 - 2));
+      *fromP += readLen;
     } else {
       if (n > toLim - *toP)
         return XML_CONVERT_OUTPUT_EXHAUSTED;
@@ -1307,9 +1311,13 @@ unknown_toUtf16(const ENCODING *enc, const char **fromP, 
const char *fromLim,
   while (*fromP < fromLim && *toP < toLim) {
     unsigned short c = uenc->utf16[(unsigned char)**fromP];
     if (c == 0) {
+      const size_t readLen
+          = (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]
+             - (BT_LEAD2 - 2));
+      if (readLen > (size_t)(fromLim - *fromP))
+        return XML_CONVERT_INPUT_INCOMPLETE;
       c = (unsigned short)uenc->convert(uenc->userData, *fromP);
-      *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]
-                 - (BT_LEAD2 - 2));
+      *fromP += readLen;
     } else
       (*fromP)++;
     *(*toP)++ = c;
-- 
2.56.0


++++++ expat-CVE-2026-124317-test-reproducer.patch ++++++
>From 05075975dc246f5f6c0757d532f22f518850e7af Mon Sep 17 00:00:00 2001
From: Sebastian Pipping <[email protected]>
Date: Fri, 6 Nov 2026 18:22:39 +0100
Subject: [PATCH 3/3] tests: Cover overread in `unknown_toUtf8`

CVE-2026-124317 / bsc#1290472. Adds
test_misc_unknown_encoding_no_source_overread to tests/misc_tests.c.

---
 expat/tests/misc_tests.c | 68 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

New regression test for CVE-2026-124317 / bsc#1290472, from upstream
commit 05075975dc246f5f6c0757d532f22f518850e7af (pull request 1492). It
adds one test case to tests/misc_tests.c. The test verifies that
the unknown encoding decoder is not called on a source shorter than
the sequence length it reads. Two-case check on the 2.10.0 source:
the test FAILS without the fix and PASSES with the fix. Adaptation
notes for 2.10.0: - The upstream test calls XML_GetBuffer64, added
by upstream commit c16a0491, which is not part of 2.10.0. This test
calls XML_GetBuffer instead. It is the only change to the upstream
commit. - The hunk applies with an offset of 29 lines.

diff --git a/expat/tests/misc_tests.c b/expat/tests/misc_tests.c
index e44272a1..9a26e1ef 100644
--- expat/tests/misc_tests.c
+++ expat/tests/misc_tests.c
@@ -982,6 +982,73 @@ 
START_TEST(test_misc_unknown_encoding_release_getter_parser_reset) {
 }
 END_TEST
 
+struct DecoderInfo {
+  size_t docLen;
+  const char *buffer;
+};
+
+static int
+decodeUnknownEncoding(void *data, const char *s) {
+  struct DecoderInfo *const info = data;
+  assert_true(info != NULL);
+
+  // Determine the sequence length in accordence with encoding map
+  const unsigned char lead = (unsigned char)s[0];
+  const int length = (lead == 0xC3) ? 2 : ((lead == 0xA9) ? 4 : 1);
+
+  const size_t offset = s - info->buffer;
+  assert_true(offset + length <= info->docLen); // or we would overread
+
+  if (lead == 0xC3 && (unsigned char)s[1] == 0xA9)
+    return 0x49;
+
+  return -1;
+}
+
+static int
+unknown_encoding_handler(void *data, const XML_Char *name, XML_Encoding *info) 
{
+  XML_Char *const expectedEncodingName = xcsdup_str("x-q5");
+  assert_true(expectedEncodingName != NULL);
+  assert_true(xcscmp(name, expectedEncodingName) == 0);
+  free(expectedEncodingName);
+
+  for (int i = 0; i < 256; i++)
+    info->map[i] = (i < 128) ? i : -1;
+
+  info->map[0xC3] = -2;
+  info->map[0xA9] = -4;
+
+  info->convert = decodeUnknownEncoding;
+  info->data = data;
+  info->release = NULL;
+
+  return XML_STATUS_OK;
+}
+
+START_TEST(test_misc_unknown_encoding_no_source_overread) {
+  const char *const doc = "<?xml \xC3\xA9?>";
+  const size_t docLen = strlen(doc);
+
+  XML_Char *const encodingName = xcsdup_str("x-q5");
+  assert_true(encodingName != NULL);
+
+  XML_Parser parser = XML_ParserCreate(encodingName);
+
+  char *const buffer = XML_GetBuffer(parser, docLen);
+  assert_true(buffer != NULL);
+  memcpy(buffer, doc, docLen);
+
+  struct DecoderInfo info = {docLen, buffer};
+  XML_SetUnknownEncodingHandler(parser, unknown_encoding_handler, &info);
+
+  assert_true(XML_ParseBuffer(parser, docLen, /*isFinal=*/XML_TRUE)
+              == XML_STATUS_ERROR);
+
+  XML_ParserFree(parser);
+  free(encodingName);
+}
+END_TEST
+
 // General attack payload idea by Jason Kratzer of Mozilla
 START_TEST(test_misc_low_surrogate_mozilla_bug_2053153) {
   const char doc_before[] = "<\0!\0D\0O\0C\0T\0Y\0P\0E\0 \0d\0 \0[\0\n\0"
@@ -1267,6 +1334,7 @@ make_miscellaneous_test_case(Suite *s) {
                  test_misc_unknown_encoding_release_getter_parser_free);
   tcase_add_test(tc_misc,
                  test_misc_unknown_encoding_release_getter_parser_reset);
+  tcase_add_test(tc_misc, test_misc_unknown_encoding_no_source_overread);
   tcase_add_test(tc_misc, test_misc_input_2gb);
   tcase_add_test(tc_misc, test_misc_low_surrogate_mozilla_bug_2053153);
   tcase_add_test(tc_misc, test_misc_storeatts_attssize_allocation);
-- 
2.56.0


++++++ expat-CVE-2026-128241-01.patch ++++++
>From 7e52b22b6462c8384d4bae60cc8fdbdaff30237b Mon Sep 17 00:00:00 2001
From: Sebastian Pipping <[email protected]>
Date: Thu, 12 Nov 2026 12:08:21 +0100
Subject: [PATCH 1/2] xmlwf: Plug symlink attacks with `-d <directory>` mode

Demo:
> # cd "$(mktemp -d)"
> # echo 'valueable content' > truncate_me
> # stat -c %s truncate_me
> 18
> # ln -s truncate_me stdin
> # xmlwf -d ./ -r /dev/stdin <<<"malformed"
> /dev/stdin:1:0: syntax error
> # stat -c %s truncate_me
> 0
CVE-2026-128241 / bsc#1290473. The -d output mode opened output
files with fopen("wb"), which follows a symbolic link. Open them with
O_NOFOLLOW instead.

---
 expat/xmlwf/xmltchar.h |  4 ++--
 expat/xmlwf/xmlwf.c    | 43 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 42 insertions(+), 5 deletions(-)

Backport of upstream commit 7e52b22b6462c8384d4bae60cc8fdbdaff30237b
(pull request 1502) to expat 2.10.0. CVE-2026-128241 /
bsc#1290473. Vanilla patch, no adaptation. The hunks apply with an
offset of 13 lines on the 2.10.0 source.

diff --git a/expat/xmlwf/xmltchar.h b/expat/xmlwf/xmltchar.h
index 37af19bc..54e2eb28 100644
--- expat/xmlwf/xmltchar.h
+++ expat/xmlwf/xmltchar.h
@@ -43,7 +43,6 @@
 #  define _PREPEND_BIG_L(x) L##x
 #  define T(x) _PREPEND_BIG_L(x)
 #  define ftprintf fwprintf
-#  define tfopen _wfopen
 #  define fputts fputws
 #  define puttc putwc
 #  define tcscmp wcscmp
@@ -54,6 +53,7 @@
 #  define tcslen wcslen
 #  define tperror _wperror
 #  define topen _wopen
+#  define tfdopen _wfdopen
 #  define tmain wmain
 #  define tremove _wremove
 #  define tchar wchar_t
@@ -62,7 +62,6 @@
 #else /* not XML_UNICODE */
 #  define T(x) x
 #  define ftprintf fprintf
-#  define tfopen fopen
 #  define fputts fputs
 #  define puttc putc
 #  define tcscmp strcmp
@@ -73,6 +72,7 @@
 #  define tcslen strlen
 #  define tperror perror
 #  define topen open
+#  define tfdopen fdopen
 #  define tmain main
 #  define tremove remove
 #  define tchar char
Backport of upstream commit 7e52b22b6462c8384d4bae60cc8fdbdaff30237b
(pull request 1502) to expat 2.10.0. CVE-2026-128241 /
bsc#1290473. Vanilla patch, no adaptation. The hunks apply with an
offset of 13 lines on the 2.10.0 source.

diff --git a/expat/xmlwf/xmlwf.c b/expat/xmlwf/xmlwf.c
index 57b9ef41..69ce8abb 100644
--- expat/xmlwf/xmlwf.c
+++ expat/xmlwf/xmlwf.c
@@ -49,7 +49,16 @@
 
 #include "expat_config.h"
 
+#if ! defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE < 200809L)
+#  define _POSIX_C_SOURCE 200809L // for O_NOFOLLOW
+#endif
+
+#if defined(__APPLE__) && ! defined(_DARWIN_C_SOURCE)
+#  define _DARWIN_C_SOURCE 1 // for O_NOFOLLOW
+#endif
+
 #include <assert.h>
+#include <fcntl.h>    // for O_WRONLY and friends
 #include <inttypes.h> // for PRIu64
 #include <stdio.h>
 #include <stdlib.h>
@@ -58,6 +67,10 @@
 #include <math.h> /* for isnan */
 #include <errno.h>
 
+#if ! defined(WIN32)
+#  include <unistd.h> // for close
+#endif
+
 #include "expat.h"
 #include "codepage.h"
 #include "internal.h" /* for UNUSED_P only */
@@ -75,6 +88,16 @@
 
 #include "../lib/xcs.h"
 
+#if defined(_WIN32) && ! defined(O_NOFOLLOW)
+#  define O_NOFOLLOW 0
+#endif
+
+#if defined(_WIN32)
+#  define O_BINARY _O_BINARY
+#else
+#  define O_BINARY 0
+#endif
+
 enum ExitCode {
   XMLWF_EXIT_SUCCESS = 0,
   XMLWF_EXIT_INTERNAL_ERROR = 1,
@@ -92,6 +115,7 @@ typedef struct NotationList {
 } NotationList;
 
 typedef struct xmlwfUserData {
+  int fd;
   FILE *fp;
   NotationList *notationListHead;
   const XML_Char *currentDoctypeName;
@@ -1018,7 +1042,7 @@ tmain(int argc, XML_Char **argv) {
   enum XML_ParamEntityParsing paramEntityParsing
       = XML_PARAM_ENTITY_PARSING_NEVER;
   int useStdin = 0;
-  XmlwfUserData userData = {NULL, NULL, NULL};
+  XmlwfUserData userData = {-1, NULL, NULL, NULL};
 
 #ifdef _MSC_VER
   _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
@@ -1285,8 +1309,21 @@ tmain(int argc, XML_Char **argv) {
       tcscpy(outName, outputDir);
       tcscat(outName, delim);
       tcscat(outName, file);
-      userData.fp = tfopen(outName, T("wb"));
-      if (! userData.fp) {
+
+      errno = 0;
+      userData.fd = topen(
+          outName, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW | O_BINARY, 0666);
+      const int openCallErrno = errno;
+      userData.fp = (userData.fd == -1) ? NULL : tfdopen(userData.fd, T("wb"));
+      const int fdopenCallErrno = errno;
+
+      if (userData.fd == -1 || userData.fp == NULL) {
+        if (userData.fd == -1) {
+          errno = openCallErrno;
+        } else {
+          close(userData.fd);
+          errno = fdopenCallErrno;
+        }
         tperror(outName);
         exitCode = XMLWF_EXIT_OUTPUT_ERROR;
         free(outName);
-- 
2.56.0


++++++ expat-CVE-2026-128241-02.patch ++++++
>From 26f00fc7b173cb89d349adc04f453579e2c48db4 Mon Sep 17 00:00:00 2001
From: Sebastian Pipping <[email protected]>
Date: Thu, 12 Nov 2026 14:56:45 +0100
Subject: [PATCH 2/2] xmlwf: Create files with `0600 & ~umask` rather than `0666 
&
 ~umask`

CVE-2026-128241 / bsc#1290473. Create the output files with mode 0600
rather than 0666.

---
 expat/xmlwf/xmlwf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Backport of upstream commit 26f00fc7b173cb89d349adc04f453579e2c48db4
(pull request 1502) to expat 2.10.0. CVE-2026-128241 /
bsc#1290473. Vanilla patch, no adaptation. Apply it after patch 1/2,
because that patch adds O_NOFOLLOW to the same call. The hunk applies
with an offset of 13 lines on the 2.10.0 source.

diff --git a/expat/xmlwf/xmlwf.c b/expat/xmlwf/xmlwf.c
index 69ce8abb..37891e87 100644
--- expat/xmlwf/xmlwf.c
+++ expat/xmlwf/xmlwf.c
@@ -1312,7 +1312,7 @@ tmain(int argc, XML_Char **argv) {
 
       errno = 0;
       userData.fd = topen(
-          outName, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW | O_BINARY, 0666);
+          outName, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW | O_BINARY, 0600);
       const int openCallErrno = errno;
       userData.fp = (userData.fd == -1) ? NULL : tfdopen(userData.fd, T("wb"));
       const int fdopenCallErrno = errno;
-- 
2.56.0

Reply via email to