[Bug 286439] textproc/libxml2 local port patch causes random x11/mate-terminal build failures
Date: Fri, 23 May 2025 22:36:46 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=286439
Dag-Erling Smørgrav <des@FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |des@FreeBSD.org
--- Comment #13 from Dag-Erling Smørgrav <des@FreeBSD.org> ---
Created attachment 260665
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=260665&action=edit
proper fix for UTF-8 bug
The reason the patch currently causes py-libxml to crash is that it was
mismerged when libxml was upgraded to 2.11.6. The “ensure the error string
doesn't start at UTF8 continuation” bit was supposed to happen after the
`vsnprintf()` call. For unexplained reasons, it was moved to _before_ that
call where, as others have pointed out, it operates on uninitialized data.
However, this patch was never the correct fix. The bug occurs when `str` is
too small for the message and the message is truncated in the middle of a UTF-8
sequence, so you need to trim the _end_ of `str`, but what the patch does is
skip any partial UTF-8 sequences that occur at the _beginning_ of `str`, which
I'm not sure is even possible unless the format string or some of the arguments
passed to the handler are malformed.
If you don't want to reintroduce the original bug, I suggest you use the
attached patch instead of just dropping patch-python_libxml.c.
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.