summaryrefslogtreecommitdiff
path: root/system/libxml2/python-segfault-fix.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-08 02:02:24 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-08 02:02:24 -0500
commitfd2bb2f751c13b3c0c002b8e012810902b9da364 (patch)
tree17b2e38c966c9f96cfa568c1f572261a289590e6 /system/libxml2/python-segfault-fix.patch
parentb0a5136bf3326ba38b360be288d06f9a27f2a4d2 (diff)
downloadpackages-fd2bb2f751c13b3c0c002b8e012810902b9da364.tar.gz
packages-fd2bb2f751c13b3c0c002b8e012810902b9da364.tar.bz2
packages-fd2bb2f751c13b3c0c002b8e012810902b9da364.tar.xz
packages-fd2bb2f751c13b3c0c002b8e012810902b9da364.zip
harmony -> system
Diffstat (limited to 'system/libxml2/python-segfault-fix.patch')
-rw-r--r--system/libxml2/python-segfault-fix.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/system/libxml2/python-segfault-fix.patch b/system/libxml2/python-segfault-fix.patch
new file mode 100644
index 000000000..f1f7554eb
--- /dev/null
+++ b/system/libxml2/python-segfault-fix.patch
@@ -0,0 +1,36 @@
+Upstream: https://bugzilla.gnome.org/show_bug.cgi?id=791691
+
+From d1ea6250dd00a3b7a92b52a743ec53f7751196e5 Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Sat, 16 Dec 2017 19:22:23 -0600
+Subject: [PATCH] Python: if message is NULL, use Py_None instead
+
+If the error message is malformed / invalid UTF-8, and the Python 3
+binding is being used, then message may be NULL. This will cause the
+Python interpreter to crash (Segmentation fault) trying to unpack the
+argument list into local variables.
+
+This uses Py_None for message if message is NULL, so that the
+interpreter does not crash.
+---
+ python/libxml.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/python/libxml.c b/python/libxml.c
+index 5b1ff6e8..dae77b88 100644
+--- a/python/libxml.c
++++ b/python/libxml.c
+@@ -1640,6 +1640,10 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNUSED void *ctx, const char *msg,
+ PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
+ Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
+ message = libxml_charPtrConstWrap(str);
++ if (message == NULL) {
++ Py_INCREF(Py_None);
++ message = Py_None;
++ }
+ PyTuple_SetItem(list, 1, message);
+ result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
+ Py_XDECREF(list);
+--
+2.14.1
+