From owner-svn-src-head@FreeBSD.ORG Sat Jun 13 15:14:40 2015 Return-Path: Delivered-To: svn-src-head@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6C9305F8; Sat, 13 Jun 2015 15:14:40 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AA84F31; Sat, 13 Jun 2015 15:14:40 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5DFEegf003080; Sat, 13 Jun 2015 15:14:40 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5DFEewh003079; Sat, 13 Jun 2015 15:14:40 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201506131514.t5DFEewh003079@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Sat, 13 Jun 2015 15:14:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284340 - head/contrib/libxo/libxo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jun 2015 15:14:40 -0000 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;