From e2e152496a588cbb9a877b9f53b261a83692c52d Mon Sep 17 00:00:00 2001 From: James Hilliard Date: Thu, 16 Jan 2025 09:11:15 -0700 Subject: [PATCH] package/libxml2: fix segfault with python-lxml Backport a patch fixing a segfault first introduced by ca63c4409b3c811e8c4ee19c2860c53af35c4ce1 in buildroot. Fixes: ==4792== Invalid read of size 8 ==4792== at 0x4FE7661: __gconv_close (gconv_close.c:33) ==4792== by 0x4FE70EE: iconv_close (iconv_close.c:34) ==4792== by 0x5AED422: xmlCharEncCloseFunc (encoding.c:2678) ==4792== by 0x587A78C: __pyx_f_4lxml_5etree__find_PyUCS4EncodingName (etree.c:126676) ==4792== by 0x5888666: __pyx_pymod_exec_etree (etree.c:289773) ==4792== by 0x4A06345: PyModule_ExecDef (moduleobject.c:440) ==4792== by 0x4AE23A8: _imp_exec_dynamic_impl (import.c:3801) ==4792== by 0x4AE23A8: _imp_exec_dynamic (import.c.h:534) ==4792== by 0x4A046A3: cfunction_vectorcall_O (methodobject.c:509) ==4792== by 0x4AAA203: _PyEval_EvalFrameDefault (bytecodes.c:3263) ==4792== by 0x49B9D2B: _PyObject_VectorcallTstate (pycore_call.h:92) ==4792== by 0x49B9D2B: object_vacall (call.c:850) ==4792== by 0x49B9F44: PyObject_CallMethodObjArgs (call.c:911) ==4792== by 0x4AE648A: import_find_and_load (import.c:2781) ==4792== by 0x4AE648A: PyImport_ImportModuleLevelObject (import.c:2864) ==4792== Address 0x8 is not stack'd, malloc'd or (recently) free'd Signed-off-by: James Hilliard Signed-off-by: Julien Olivain --- ...0002-Fix-Fix-compilation-with-uclibc.patch | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 package/libxml2/0002-Fix-Fix-compilation-with-uclibc.patch diff --git a/package/libxml2/0002-Fix-Fix-compilation-with-uclibc.patch b/package/libxml2/0002-Fix-Fix-compilation-with-uclibc.patch new file mode 100644 index 0000000000..76ea711962 --- /dev/null +++ b/package/libxml2/0002-Fix-Fix-compilation-with-uclibc.patch @@ -0,0 +1,31 @@ +From 539663626b91567159a70791c0f2b3b167135e9b Mon Sep 17 00:00:00 2001 +From: Nick Wellnhofer +Date: Thu, 16 Jan 2025 15:50:46 +0100 +Subject: [PATCH] Fix "Fix compilation with uclibc" + +The ICU code must initialize the iconv members as well. + +Signed-off-by: James Hilliard +Upstream: https://gitlab.gnome.org/GNOME/libxml2/-/commit/539663626b91567159a70791c0f2b3b167135e9b +--- + encoding.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/encoding.c b/encoding.c +index 41ecde18..0ce8d479 100644 +--- a/encoding.c ++++ b/encoding.c +@@ -1641,6 +1641,10 @@ xmlCreateUconvHandler(const char *name, xmlCharEncodingHandler **out) { + } + enc->input = NULL; + enc->output = NULL; ++#ifdef LIBXML_ICONV_ENABLED ++ enc->iconv_in = (iconv_t) -1; ++ enc->iconv_out = (iconv_t) -1; ++#endif + enc->uconv_in = ucv_in; + enc->uconv_out = ucv_out; + +-- +2.34.1 +