pkgsrc-Changes archive

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

CVS commit: pkgsrc/textproc



Module Name:    pkgsrc
Committed By:   wiz
Date:           Wed Jan  9 13:40:51 UTC 2019

Modified Files:
        pkgsrc/textproc/libxml2: distinfo
        pkgsrc/textproc/py-libxml2: Makefile
Added Files:
        pkgsrc/textproc/libxml2/patches: patch-python_libxml.c

Log Message:
py-libxml2: work around a problem in error handling.

In some cases, invalid UTF-8 strings were returned which caused
python interpreter crashes. See

https://github.com/itstool/itstool/issues/22

Use a variant of the patch that was used in Fedora.

Bump PKGREVISION.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 pkgsrc/textproc/libxml2/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/textproc/libxml2/patches/patch-python_libxml.c
cvs rdiff -u -r1.62 -r1.63 pkgsrc/textproc/py-libxml2/Makefile

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/distinfo
diff -u pkgsrc/textproc/libxml2/distinfo:1.128 pkgsrc/textproc/libxml2/distinfo:1.129
--- pkgsrc/textproc/libxml2/distinfo:1.128      Fri Nov  9 15:31:46 2018
+++ pkgsrc/textproc/libxml2/distinfo    Wed Jan  9 13:40:50 2019
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.128 2018/11/09 15:31:46 leot Exp $
+$NetBSD: distinfo,v 1.129 2019/01/09 13:40:50 wiz Exp $
 
 SHA1 (libxml2-2.9.8.tar.gz) = 66bcefd98a6b7573427cf66f9d3841b59eb5b8c3
 RMD160 (libxml2-2.9.8.tar.gz) = a3bf30ed652cfa2e06c64ae62c95a5ebd889c7a7
@@ -11,6 +11,7 @@ SHA1 (patch-ad) = d65b7e3be9694147e96ce4
 SHA1 (patch-ae) = 4eede9719724f94402e850ee6d6043a74aaf62b2
 SHA1 (patch-encoding.c) = 6cf0a7d421828b9f40a4079ee85adb791c54d096
 SHA1 (patch-parser.c) = ea27ffe37b8a47d08a2e2a0220ec5592c9980190
+SHA1 (patch-python_libxml.c) = cfa07b4f3dfddb501c2ba210bb32b8ee14e3df9d
 SHA1 (patch-python_libxml.py) = 869a72ae5ba2e27e6d46552878890acb22337675
 SHA1 (patch-python_libxml2.py) = 209d105b0f3aedb834091390a7c6819705108e34
 SHA1 (patch-python_setup.py) = 7771fd02ee6779463f1d3321f099d7e6d19cd1b1

Index: pkgsrc/textproc/py-libxml2/Makefile
diff -u pkgsrc/textproc/py-libxml2/Makefile:1.62 pkgsrc/textproc/py-libxml2/Makefile:1.63
--- pkgsrc/textproc/py-libxml2/Makefile:1.62    Fri Jul 13 11:31:58 2018
+++ pkgsrc/textproc/py-libxml2/Makefile Wed Jan  9 13:40:51 2019
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.62 2018/07/13 11:31:58 jperkin Exp $
+# $NetBSD: Makefile,v 1.63 2019/01/09 13:40:51 wiz Exp $
 
 .include "../../textproc/libxml2/Makefile.common"
 
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
+PKGREVISION=   1
 
 COMMENT=       Python wrapper for libxml2
 LICENSE=       modified-bsd

Added files:

Index: pkgsrc/textproc/libxml2/patches/patch-python_libxml.c
diff -u /dev/null pkgsrc/textproc/libxml2/patches/patch-python_libxml.c:1.1
--- /dev/null   Wed Jan  9 13:40:51 2019
+++ pkgsrc/textproc/libxml2/patches/patch-python_libxml.c       Wed Jan  9 13:40:50 2019
@@ -0,0 +1,32 @@
+$NetBSD: patch-python_libxml.c,v 1.1 2019/01/09 13:40:50 wiz Exp $
+
+Avoid returning invalid UTF-8 strings to python.
+Based on https://bugzilla.opensuse.org/attachment.cgi?id=746044&action=edit
+Fixes https://github.com/itstool/itstool/issues/22
+
+--- python/libxml.c.orig       2016-06-07 10:04:14.000000000 +0000
++++ python/libxml.c
+@@ -1620,6 +1620,7 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
+     PyObject *message;
+     PyObject *result;
+     char str[1000];
++    unsigned char *ptr = (unsigned char *)str;
+ 
+ #ifdef DEBUG_ERROR
+     printf("libxml_xmlErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
+@@ -1636,10 +1637,14 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
+           str[999] = 0;
+         va_end(ap);
+ 
++        /* Ensure the error string doesn't start at UTF8 continuation. */
++        while (*ptr && (*ptr & 0xc0) == 0x80)
++          ptr++;
++
+         list = PyTuple_New(2);
+         PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
+         Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
+-        message = libxml_charPtrConstWrap(str);
++        message = libxml_charPtrConstWrap(ptr);
+         PyTuple_SetItem(list, 1, message);
+         result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
+         Py_XDECREF(list);



Home | Main Index | Thread Index | Old Index