pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/textproc py-libxml2: work around a problem in error ha...
details: https://anonhg.NetBSD.org/pkgsrc/rev/5267da0eca66
branches: trunk
changeset: 327822:5267da0eca66
user: wiz <wiz%pkgsrc.org@localhost>
date: Wed Jan 09 13:40:50 2019 +0000
description:
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.
diffstat:
textproc/libxml2/distinfo | 3 +-
textproc/libxml2/patches/patch-python_libxml.c | 32 ++++++++++++++++++++++++++
textproc/py-libxml2/Makefile | 3 +-
3 files changed, 36 insertions(+), 2 deletions(-)
diffs (67 lines):
diff -r c392776a20a9 -r 5267da0eca66 textproc/libxml2/distinfo
--- a/textproc/libxml2/distinfo Wed Jan 09 13:19:03 2019 +0000
+++ b/textproc/libxml2/distinfo Wed Jan 09 13:40:50 2019 +0000
@@ -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-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
diff -r c392776a20a9 -r 5267da0eca66 textproc/libxml2/patches/patch-python_libxml.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/libxml2/patches/patch-python_libxml.c Wed Jan 09 13:40:50 2019 +0000
@@ -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);
diff -r c392776a20a9 -r 5267da0eca66 textproc/py-libxml2/Makefile
--- a/textproc/py-libxml2/Makefile Wed Jan 09 13:19:03 2019 +0000
+++ b/textproc/py-libxml2/Makefile Wed Jan 09 13:40:50 2019 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index