pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/textproc/libxslt libxslt: address CVE-2021-30560



details:   https://anonhg.NetBSD.org/pkgsrc/rev/75b68c5c7867
branches:  trunk
changeset: 385292:75b68c5c7867
user:      gutteridge <gutteridge%pkgsrc.org@localhost>
date:      Tue Sep 13 21:34:00 2022 +0000

description:
libxslt: address CVE-2021-30560

Cherry-picked from the (new) upstream's 1.1.35 release.

diffstat:

 textproc/libxslt/Makefile                          |    4 +-
 textproc/libxslt/distinfo                          |    3 +-
 textproc/libxslt/patches/patch-libxslt_transform.c |  159 +++++++++++++++++++++
 3 files changed, 163 insertions(+), 3 deletions(-)

diffs (190 lines):

diff -r 88b8ce2f9769 -r 75b68c5c7867 textproc/libxslt/Makefile
--- a/textproc/libxslt/Makefile Tue Sep 13 17:55:49 2022 +0000
+++ b/textproc/libxslt/Makefile Tue Sep 13 21:34:00 2022 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.119 2022/06/28 11:36:12 wiz Exp $
+# $NetBSD: Makefile,v 1.120 2022/09/13 21:34:00 gutteridge Exp $
 
 .include "Makefile.common"
 
-PKGREVISION=   9
+PKGREVISION=   10
 
 BUILD_DEPENDS+=        docbook-xml-[0-9]*:../../textproc/docbook-xml
 BUILD_DEPENDS+=        docbook-xsl-[0-9]*:../../textproc/docbook-xsl
diff -r 88b8ce2f9769 -r 75b68c5c7867 textproc/libxslt/distinfo
--- a/textproc/libxslt/distinfo Tue Sep 13 17:55:49 2022 +0000
+++ b/textproc/libxslt/distinfo Tue Sep 13 21:34:00 2022 +0000
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.68 2021/10/26 11:22:18 nia Exp $
+$NetBSD: distinfo,v 1.69 2022/09/13 21:34:00 gutteridge Exp $
 
 BLAKE2s (libxslt-1.1.34.tar.gz) = e17d720708ac550a120ee49856cf3c4ea92663fc42e5011bbae1d3e660519183
 SHA512 (libxslt-1.1.34.tar.gz) = 1516a11ad608b04740674060d2c5d733b88889de5e413b9a4e8bf8d1a90d712149df6d2b1345b615f529d7c7d3fa6dae12e544da828b39c7d415e54c0ee0776b
 Size (libxslt-1.1.34.tar.gz) = 3552258 bytes
 SHA1 (patch-configure) = a63c214c7f5e4c4f89307c18519240372382c2fa
 SHA1 (patch-libexslt_date.c) = 40ce3940a93b6a2dc804f62676909d3313e0ea52
+SHA1 (patch-libxslt_transform.c) = 6d76f6fd91a8729bb6a3b61f4866453c0fd08c62
diff -r 88b8ce2f9769 -r 75b68c5c7867 textproc/libxslt/patches/patch-libxslt_transform.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/libxslt/patches/patch-libxslt_transform.c        Tue Sep 13 21:34:00 2022 +0000
@@ -0,0 +1,159 @@
+$NetBSD: patch-libxslt_transform.c,v 1.1 2022/09/13 21:34:00 gutteridge Exp $
+
+Address CVE-2021-30560
+https://gitlab.gnome.org/GNOME/libxslt/-/commit/50f9c9cd3b7dfe9b3c8c795247752d1fdcadcac8
+
+--- libxslt/transform.c.orig   2019-10-23 17:36:39.000000000 +0000
++++ libxslt/transform.c
+@@ -1895,7 +1895,7 @@ static void
+ xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node,
+                         xsltStackElemPtr params) {
+     xmlNodePtr copy;
+-    xmlNodePtr delete = NULL, cur;
++    xmlNodePtr cur;
+     int nbchild = 0, oldSize;
+     int childno = 0, oldPos;
+     xsltTemplatePtr template;
+@@ -1968,54 +1968,13 @@ xsltDefaultProcessOneNode(xsltTransformC
+           return;
+     }
+     /*
+-     * Handling of Elements: first pass, cleanup and counting
++     * Handling of Elements: first pass, counting
+      */
+     cur = node->children;
+     while (cur != NULL) {
+-      switch (cur->type) {
+-          case XML_TEXT_NODE:
+-          case XML_CDATA_SECTION_NODE:
+-          case XML_DOCUMENT_NODE:
+-          case XML_HTML_DOCUMENT_NODE:
+-          case XML_ELEMENT_NODE:
+-          case XML_PI_NODE:
+-          case XML_COMMENT_NODE:
+-              nbchild++;
+-              break;
+-            case XML_DTD_NODE:
+-              /* Unlink the DTD, it's still reachable using doc->intSubset */
+-              if (cur->next != NULL)
+-                  cur->next->prev = cur->prev;
+-              if (cur->prev != NULL)
+-                  cur->prev->next = cur->next;
+-              break;
+-          default:
+-#ifdef WITH_XSLT_DEBUG_PROCESS
+-              XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+-               "xsltDefaultProcessOneNode: skipping node type %d\n",
+-                               cur->type));
+-#endif
+-              delete = cur;
+-      }
++      if (IS_XSLT_REAL_NODE(cur))
++          nbchild++;
+       cur = cur->next;
+-      if (delete != NULL) {
+-#ifdef WITH_XSLT_DEBUG_PROCESS
+-          XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+-               "xsltDefaultProcessOneNode: removing ignorable blank node\n"));
+-#endif
+-          xmlUnlinkNode(delete);
+-          xmlFreeNode(delete);
+-          delete = NULL;
+-      }
+-    }
+-    if (delete != NULL) {
+-#ifdef WITH_XSLT_DEBUG_PROCESS
+-      XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
+-           "xsltDefaultProcessOneNode: removing ignorable blank node\n"));
+-#endif
+-      xmlUnlinkNode(delete);
+-      xmlFreeNode(delete);
+-      delete = NULL;
+     }
+ 
+     /*
+@@ -4864,7 +4823,7 @@ xsltApplyTemplates(xsltTransformContextP
+     xsltStylePreCompPtr comp = (xsltStylePreCompPtr) castedComp;
+ #endif
+     int i;
+-    xmlNodePtr cur, delNode = NULL, oldContextNode;
++    xmlNodePtr cur, oldContextNode;
+     xmlNodeSetPtr list = NULL, oldList;
+     xsltStackElemPtr withParams = NULL;
+     int oldXPProximityPosition, oldXPContextSize;
+@@ -4998,73 +4957,9 @@ xsltApplyTemplates(xsltTransformContextP
+       else
+           cur = NULL;
+       while (cur != NULL) {
+-          switch (cur->type) {
+-              case XML_TEXT_NODE:
+-                  if ((IS_BLANK_NODE(cur)) &&
+-                      (cur->parent != NULL) &&
+-                      (cur->parent->type == XML_ELEMENT_NODE) &&
+-                      (ctxt->style->stripSpaces != NULL)) {
+-                      const xmlChar *val;
+-
+-                      if (cur->parent->ns != NULL) {
+-                          val = (const xmlChar *)
+-                                xmlHashLookup2(ctxt->style->stripSpaces,
+-                                               cur->parent->name,
+-                                               cur->parent->ns->href);
+-                          if (val == NULL) {
+-                              val = (const xmlChar *)
+-                                xmlHashLookup2(ctxt->style->stripSpaces,
+-                                               BAD_CAST "*",
+-                                               cur->parent->ns->href);
+-                          }
+-                      } else {
+-                          val = (const xmlChar *)
+-                                xmlHashLookup2(ctxt->style->stripSpaces,
+-                                               cur->parent->name, NULL);
+-                      }
+-                      if ((val != NULL) &&
+-                          (xmlStrEqual(val, (xmlChar *) "strip"))) {
+-                          delNode = cur;
+-                          break;
+-                      }
+-                  }
+-                  /* Intentional fall-through */
+-              case XML_ELEMENT_NODE:
+-              case XML_DOCUMENT_NODE:
+-              case XML_HTML_DOCUMENT_NODE:
+-              case XML_CDATA_SECTION_NODE:
+-              case XML_PI_NODE:
+-              case XML_COMMENT_NODE:
+-                  xmlXPathNodeSetAddUnique(list, cur);
+-                  break;
+-              case XML_DTD_NODE:
+-                  /* Unlink the DTD, it's still reachable
+-                   * using doc->intSubset */
+-                  if (cur->next != NULL)
+-                      cur->next->prev = cur->prev;
+-                  if (cur->prev != NULL)
+-                      cur->prev->next = cur->next;
+-                  break;
+-              case XML_NAMESPACE_DECL:
+-                  break;
+-              default:
+-#ifdef WITH_XSLT_DEBUG_PROCESS
+-                  XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+-                   "xsltApplyTemplates: skipping cur type %d\n",
+-                                   cur->type));
+-#endif
+-                  delNode = cur;
+-          }
++            if (IS_XSLT_REAL_NODE(cur))
++              xmlXPathNodeSetAddUnique(list, cur);
+           cur = cur->next;
+-          if (delNode != NULL) {
+-#ifdef WITH_XSLT_DEBUG_PROCESS
+-              XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+-                   "xsltApplyTemplates: removing ignorable blank cur\n"));
+-#endif
+-              xmlUnlinkNode(delNode);
+-              xmlFreeNode(delNode);
+-              delNode = NULL;
+-          }
+       }
+     }
+ 



Home | Main Index | Thread Index | Old Index