Skip to contentSkip to conversation

package/libxml2: fix segfault with python-lxml

PATCH In review James Hilliard 3 participants 3 messages Jan 16, 2025 – Jan 22, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 ...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
package/libxml2/0002-Fix-Fix-compilation-with-uclibc.patch new file +31 -0
new file mode 100644
index 0000000000..76ea711962
@@ -0,0 +1,31 @@
+From 539663626b91567159a70791c0f2b3b167135e9b Mon Sep 17 00:00:00 2001
+From: Nick Wellnhofer <[email protected]>
+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 <[email protected]>
+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
+
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 20 lines · James Hilliard

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)
Quoted 3 lines

==4792== Address 0x8 is not stack'd, malloc'd or (recently) free'd

Applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to James Hilliard
Quoted 22 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"James" == James Hilliard <[email protected]> writes:

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)
Quoted 3 lines

==4792== Address 0x8 is not stack'd, malloc'd or (recently) free'd

Committed to 2024.11.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot