pkgsrc-Changes archive

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

CVS commit: pkgsrc/textproc/libxml2



Module Name:    pkgsrc
Committed By:   gutteridge
Date:           Thu Jan 26 01:49:16 UTC 2023

Modified Files:
        pkgsrc/textproc/libxml2: Makefile.common distinfo
Added Files:
        pkgsrc/textproc/libxml2/patches: patch-error.c

Log Message:
libxml2: Make sure that error messages are valid UTF-8

Fixes segfaults with itstool, which were breaking various MATE package
builds. (This is the third time a variant of a patch to fix this same
issue has been applied here.)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 pkgsrc/textproc/libxml2/Makefile.common
cvs rdiff -u -r1.142 -r1.143 pkgsrc/textproc/libxml2/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/textproc/libxml2/patches/patch-error.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/textproc/libxml2/Makefile.common
diff -u pkgsrc/textproc/libxml2/Makefile.common:1.17 pkgsrc/textproc/libxml2/Makefile.common:1.18
--- pkgsrc/textproc/libxml2/Makefile.common:1.17        Sun Jan 22 10:30:08 2023
+++ pkgsrc/textproc/libxml2/Makefile.common     Thu Jan 26 01:49:16 2023
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile.common,v 1.17 2023/01/22 10:30:08 wiz Exp $
+# $NetBSD: Makefile.common,v 1.18 2023/01/26 01:49:16 gutteridge Exp $
 #
 # used by textproc/libxml2/Makefile
 # used by textproc/py-libxml2/Makefile
 
 DISTNAME=      libxml2-2.10.3
+PKGREVISION=   1
 CATEGORIES=    textproc
 MASTER_SITES=  ${MASTER_SITE_GNOME:=sources/libxml2/${PKGVERSION_NOREV:R}/}
 EXTRACT_SUFX=  .tar.xz

Index: pkgsrc/textproc/libxml2/distinfo
diff -u pkgsrc/textproc/libxml2/distinfo:1.142 pkgsrc/textproc/libxml2/distinfo:1.143
--- pkgsrc/textproc/libxml2/distinfo:1.142      Sun Jan 22 10:30:08 2023
+++ pkgsrc/textproc/libxml2/distinfo    Thu Jan 26 01:49:16 2023
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.142 2023/01/22 10:30:08 wiz Exp $
+$NetBSD: distinfo,v 1.143 2023/01/26 01:49:16 gutteridge Exp $
 
 BLAKE2s (libxml2-2.10.3.tar.xz) = e46e6337acb5ff88e6206d1d61ee8b27d66c5f716c98e830c3504a01dc178ad6
 SHA512 (libxml2-2.10.3.tar.xz) = 33bb87ae9a45c475c3de09477e5d94840d8f687f893ef7839408bc7267e57611c4f2b863ed8ec819a4b5f1ebd6a122db9f6054c73bceed427d37f3e67f62620c
 Size (libxml2-2.10.3.tar.xz) = 2639908 bytes
 SHA1 (patch-configure) = 3d73d05780562dccd5f9621d9e9f15f2d62cfa87
 SHA1 (patch-encoding.c) = 7fe0f67db061a2f46abe1c4b6b4d8a0402f82830
+SHA1 (patch-error.c) = 77561e820e0da96acb572378c2f2a0b9b84112e1

Added files:

Index: pkgsrc/textproc/libxml2/patches/patch-error.c
diff -u /dev/null pkgsrc/textproc/libxml2/patches/patch-error.c:1.1
--- /dev/null   Thu Jan 26 01:49:16 2023
+++ pkgsrc/textproc/libxml2/patches/patch-error.c       Thu Jan 26 01:49:16 2023
@@ -0,0 +1,63 @@
+$NetBSD: patch-error.c,v 1.1 2023/01/26 01:49:16 gutteridge Exp $
+
+Make sure that error messages are valid UTF-8. Fixes itstool segfaults.
+https://gitlab.gnome.org/GNOME/libxml2/-/commit/76c6da420923f2721a2e16adfcef8707a2454a1b
+
+--- error.c.orig       2022-10-14 12:20:48.000000000 +0000
++++ error.c
+@@ -163,7 +163,7 @@ xmlParserPrintFileInfo(xmlParserInputPtr
+ }
+ 
+ /**
+- * xmlParserPrintFileContext:
++ * xmlParserPrintFileContextInternal:
+  * @input:  an xmlParserInputPtr input
+  *
+  * Displays current context within the input content for error tracking
+@@ -172,7 +172,7 @@ xmlParserPrintFileInfo(xmlParserInputPtr
+ static void
+ xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
+               xmlGenericErrorFunc channel, void *data ) {
+-    const xmlChar *cur, *base;
++    const xmlChar *cur, *base, *start;
+     unsigned int n, col;      /* GCC warns if signed, because compared with sizeof() */
+     xmlChar  content[81]; /* space for 80 chars + line terminator */
+     xmlChar *ctnt;
+@@ -191,19 +191,30 @@ xmlParserPrintFileContextInternal(xmlPar
+     while ((n++ < (sizeof(content)-1)) && (cur > base) &&
+          (*(cur) != '\n') && (*(cur) != '\r'))
+         cur--;
+-    if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
++    if ((*(cur) == '\n') || (*(cur) == '\r')) {
++        cur++;
++    } else {
++        /* skip over continuation bytes */
++        while ((cur < input->cur) && ((*cur & 0xC0) == 0x80))
++            cur++;
++    }
+     /* calculate the error position in terms of the current position */
+     col = input->cur - cur;
+     /* search forward for end-of-line (to max buff size) */
+     n = 0;
+-    ctnt = content;
++    start = cur;
+     /* copy selected text to our buffer */
+-    while ((*cur != 0) && (*(cur) != '\n') &&
+-         (*(cur) != '\r') && (n < sizeof(content)-1)) {
+-              *ctnt++ = *cur++;
+-      n++;
++    while ((*cur != 0) && (*(cur) != '\n') && (*(cur) != '\r')) {
++        int len = input->end - cur;
++        int c = xmlGetUTF8Char(cur, &len);
++
++        if ((c < 0) || (n + len > sizeof(content)-1))
++            break;
++        cur += len;
++      n += len;
+     }
+-    *ctnt = 0;
++    memcpy(content, start, n);
++    content[n] = 0;
+     /* print out the selected text */
+     channel(data ,"%s\n", content);
+     /* create blank line with problem pointer */



Home | Main Index | Thread Index | Old Index