diff options
author | wiz <wiz@pkgsrc.org> | 2019-01-09 13:40:50 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2019-01-09 13:40:50 +0000 |
commit | adca894d80b52a093a9093d70d1b001a64d9ae07 (patch) | |
tree | 7f680933233aa9bef214be6530c343f0faa2b6b9 /textproc/libxml2 | |
parent | 05a5c8debd3d1303c2995617d0b31b772c7a9bf2 (diff) | |
download | pkgsrc-adca894d80b52a093a9093d70d1b001a64d9ae07.tar.gz |
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 (limited to 'textproc/libxml2')
-rw-r--r-- | textproc/libxml2/distinfo | 3 | ||||
-rw-r--r-- | textproc/libxml2/patches/patch-python_libxml.c | 32 |
2 files changed, 34 insertions, 1 deletions
diff --git a/textproc/libxml2/distinfo b/textproc/libxml2/distinfo index f21d596e978..79986a8faeb 100644 --- a/textproc/libxml2/distinfo +++ b/textproc/libxml2/distinfo @@ -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) = d65b7e3be9694147e96ce4bb70a1739e2279ba81 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 --git a/textproc/libxml2/patches/patch-python_libxml.c b/textproc/libxml2/patches/patch-python_libxml.c new file mode 100644 index 00000000000..9fdc6f689f9 --- /dev/null +++ b/textproc/libxml2/patches/patch-python_libxml.c @@ -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); |