From 77b52c35202d3e52f4e4a30dd76bbe36feb97a87 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 18 Jun 2025 09:29:57 +0200 Subject: [PATCH] libxml2: Apply ABI breaking patch from Chromium needed for libxslt CVE fixes --- .../development/libraries/libxml2/default.nix | 9 +++++++++ .../libraries/libxml2/xml-attr-extra.patch | 20 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pkgs/development/libraries/libxml2/xml-attr-extra.patch diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix index 31e058c01048..9c93590323c7 100644 --- a/pkgs/development/libraries/libxml2/default.nix +++ b/pkgs/development/libraries/libxml2/default.nix @@ -51,6 +51,15 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-J3KUyzMRmrcbK8gfL0Rem8lDW4k60VuyzSsOhZoO6Eo="; }; + patches = [ + # Unmerged ABI-breaking patch required to fix the following security issues: + # - https://gitlab.gnome.org/GNOME/libxslt/-/issues/139 + # - https://gitlab.gnome.org/GNOME/libxslt/-/issues/140 + # See also https://gitlab.gnome.org/GNOME/libxml2/-/issues/906 + # Source: https://github.com/chromium/chromium/blob/4fb4ae8ce3daa399c3d8ca67f2dfb9deffcc7007/third_party/libxml/chromium/xml-attr-extra.patch + ./xml-attr-extra.patch + ]; + strictDeps = true; nativeBuildInputs = [ diff --git a/pkgs/development/libraries/libxml2/xml-attr-extra.patch b/pkgs/development/libraries/libxml2/xml-attr-extra.patch new file mode 100644 index 000000000000..8753c30e3893 --- /dev/null +++ b/pkgs/development/libraries/libxml2/xml-attr-extra.patch @@ -0,0 +1,20 @@ +diff --git a/include/libxml/tree.h b/include/libxml/tree.h +index e5a8fb709471f..7819d5819b427 100644 +--- a/include/libxml/tree.h ++++ b/include/libxml/tree.h +@@ -454,6 +454,7 @@ struct _xmlAttr { + xmlAttributeType atype; /* the attribute type if validating */ + void *psvi; /* for type/PSVI information */ + struct _xmlID *id; /* the ID struct */ ++ unsigned int extra; /* extra data for XPath/XSLT */ + }; + + /** +@@ -592,6 +593,7 @@ struct _xmlDoc { + document */ + int properties; /* set of xmlDocProperties for this document + set at the end of parsing */ ++ unsigned int extra; /* extra data for XPath/XSLT */ + }; + +