Date: Sat, 13 Jun 2015 15:14:40 +0000 (UTC) From: Alexander Kabaev <kan@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284340 - head/contrib/libxo/libxo Message-ID: <201506131514.t5DFEewh003079@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kan Date: Sat Jun 13 15:14:39 2015 New Revision: 284340 URL: https://svnweb.freebsd.org/changeset/base/284340 Log: Unbreak libxo's handling of characters not representable in current locale The xo_format_string_direct function loops forever never advancing the processed string pointer when it encounters a character that makes mbrtowc fail. Make it emit '?' character instead, as it seems this is what the code intent was, sans bugs. Differential Revision: https://reviews.freebsd.org/D2802 Reviewed by: marcel Modified: head/contrib/libxo/libxo/libxo.c Modified: head/contrib/libxo/libxo/libxo.c ============================================================================== --- head/contrib/libxo/libxo/libxo.c Sat Jun 13 14:24:31 2015 (r284339) +++ head/contrib/libxo/libxo/libxo.c Sat Jun 13 15:14:39 2015 (r284340) @@ -2077,7 +2077,8 @@ xo_format_string_direct (xo_handle_t *xo ilen = mbrtowc(&wc, cp, ilen, &xop->xo_mbstate); if (ilen < 0) { /* Invalid data; skip */ xo_failure(xop, "invalid mbs char: %02hhx", *cp); - continue; + wc = L'?'; + ilen = 1; } if (ilen == 0) { /* Hit a wide NUL character */ len = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506131514.t5DFEewh003079>