libxml2: 2.10.4 → 2.11.4

https://gitlab.gnome.org/GNOME/libxml2/-/compare/2.10.4...2.11.4
This commit is contained in:
Jan Tojnar 2023-07-05 00:56:14 +00:00
parent f4dc0763b8
commit 7d9be8a366
2 changed files with 2 additions and 47 deletions

View file

@ -34,7 +34,7 @@ in
let
libxml = stdenv.mkDerivation rec {
pname = "libxml2";
version = "2.10.4";
version = "2.11.4";
outputs = [ "bin" "dev" "out" "doc" ]
++ lib.optional pythonSupport "py"
@ -43,24 +43,9 @@ libxml = stdenv.mkDerivation rec {
src = fetchurl {
url = "mirror://gnome/sources/libxml2/${lib.versions.majorMinor version}/libxml2-${version}.tar.xz";
sha256 = "7QyRxYRQCPGTZznk7uIDVTHByUdCxlQfRO5m2IWUjUU=";
sha256 = "c34df4qz8TlynKE6JJT9F78w3bS3pCfPM2JSyrV/V/c=";
};
patches = [
# Upstream bugs:
# https://bugzilla.gnome.org/show_bug.cgi?id=789714
# https://gitlab.gnome.org/GNOME/libxml2/issues/64
# Patch from https://bugzilla.opensuse.org/show_bug.cgi?id=1065270 ,
# but only the UTF-8 part.
# Can also be mitigated by fixing malformed XML inputs, such as in
# https://gitlab.gnome.org/GNOME/gnumeric/merge_requests/3 .
# Other discussion:
# https://github.com/itstool/itstool/issues/22
# https://github.com/NixOS/nixpkgs/pull/63174
# https://github.com/NixOS/nixpkgs/pull/72342
./utf8-xmlErrorFuncHandler.patch
];
strictDeps = true;
nativeBuildInputs = [

View file

@ -1,30 +0,0 @@
Index: libxml2-2.9.5/python/libxml.c
===================================================================
--- libxml2-2.9.5.orig/python/libxml.c
+++ libxml2-2.9.5/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,16 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
str[999] = 0;
va_end(ap);
+#if PY_MAJOR_VERSION >= 3
+ /* Ensure the error string doesn't start at UTF8 continuation. */
+ while (*ptr && (*ptr & 0xc0) == 0x80)
+ ptr++;
+#endif
+
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);