From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Nov 29 21:20:02 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 344FC16A4CE for ; Mon, 29 Nov 2004 21:20:02 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 12BB543D31 for ; Mon, 29 Nov 2004 21:20:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id iATLK1U9008091 for ; Mon, 29 Nov 2004 21:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id iATLK1nE008090; Mon, 29 Nov 2004 21:20:01 GMT (envelope-from gnats) Resent-Date: Mon, 29 Nov 2004 21:20:01 GMT Resent-Message-Id: <200411292120.iATLK1nE008090@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Wataru Gotoh Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7B22616A4CE for ; Mon, 29 Nov 2004 21:18:32 +0000 (GMT) Received: from mail501.nifty.com (mail501.nifty.com [202.248.37.209]) by mx1.FreeBSD.org (Postfix) with ESMTP id ACBC043D49 for ; Mon, 29 Nov 2004 21:18:31 +0000 (GMT) (envelope-from gotow@nifty.com) Received: from localhost (nthkid005209.hkid.nt.isdn.ppp.infoweb.ne.jp [211.133.110.209])by mail501.nifty.com with SMTP id iATLIJol014078 for ; Tue, 30 Nov 2004 06:18:20 +0900 Received: by localhost (sSMTP sendmail emulation); Tue, 30 Nov 2004 06:18:19 +0900 Message-Id: <20041129211819.GA34557%gotow@nifty.com> Date: Tue, 30 Nov 2004 06:18:19 +0900 From: Wataru Gotoh To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/74537: editors/vim issue: report invalid size of multi-byte character X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Wataru Gotoh List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2004 21:20:02 -0000 >Number: 74537 >Category: ports >Synopsis: editors/vim issue: report invalid size of multi-byte character >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Nov 29 21:20:01 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Wataru Gotoh >Release: FreeBSD 5.3-RELEASE-p1 i386 >Organization: >Environment: System: GENERIC kernel. >Description: editors/vim on FreeBSD 5-stable (include 5.3R) report invalid size of multi-byte character. this issue poses some problem, on display text, on moving cursor, and more. vim call "mblen()" for make "mb_bytelen_tab" table at vim63/src/mbyte.c in function named mb_init(). current spec of mblen() is not suppose for make this table. >How-To-Repeat: test code of make table. #include #include #include int main(void) { int i, n; char buf[2]; fprintf(stdout, "%s\n", setlocale(LC_ALL, "ja_JP.eucJP")); for (i = 0; i < 256; i++) { buf[0] = i; buf[1] = '\0'; if (i == '\0') { n = 1; } else { if (mblen(buf, (size_t)1) <= 0) { n = 2; } else { n = 1; } } fprintf(stdout, "%d,", n); if ((i + 1) % 32 == 0) { fprintf(stdout, "\n"); } } return 0; } valid case: (on 5.2.1R) ja_JP.eucJP 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1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byte_c Thu Jan 1 09:00:00 1970 +++ vim/files/patch-mbyte_c Tue Nov 30 04:16:47 2004 @@ -0,0 +1,10 @@ +--- mbyte.c.orig Sun Nov 28 20:40:35 2004 ++++ mbyte.c Sun Nov 28 20:42:49 2004 +@@ -650,6 +650,7 @@ + * where mblen() returns 0 for invalid character. + * Therefore, following condition includes 0. + */ ++ mblen(NULL, 0); + if (mblen(buf, (size_t)1) <= 0) + n = 2; + else >Release-Note: >Audit-Trail: >Unformatted: