From owner-freebsd-current@freebsd.org Wed Nov 25 15:31:21 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01859A3705D for ; Wed, 25 Nov 2015 15:31:21 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A330B1B23 for ; Wed, 25 Nov 2015 15:31:20 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by lffu14 with SMTP id u14so64900850lff.1 for ; Wed, 25 Nov 2015 07:31:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type; bh=Pjcxk1+zOioTrSCvDbd3FQohGC2IgEX/lYhKvb8CZzI=; b=NHlvE8dwyH2/SFnbG+HrsmcS0aOly2ivQZTh8TpNMlun50KJeUc+nrwTc1FRmweVmk 5/78uEZIxpxveOkcL3nORbVhXgo5fBwf8v3DB5IjI9LEad5qalAG6TZlCAvcdoVbD2P9 TGFMbdYIjKYIC3CeQVJ7ziDh96AfI8pbdtgGpX3qT5DbzQkxRyZ9vaADQsQOFl2aXfzI iVz5vDsZKcQwMVRWDzqbuWx7/MOSiaWA48wuXZUXIGITy546jBzOhA02amFTsaxaljRL m4/BeLjN+jvr89XXG2j612AcSXPQVdEJbdTut2KLibacZgu8/Zem6Th5OuCKGX5j5soz 6ErA== X-Gm-Message-State: ALoCoQkfXRtXdvYJRGdxMsTfUIuHic0F+WbZice8TPL1HfmYmce4NzNqvK2ShZp79ouyU02EhjVh X-Received: by 10.25.207.14 with SMTP id f14mr10606287lfg.29.1448465478768; Wed, 25 Nov 2015 07:31:18 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id g5sm3344351lbd.26.2015.11.25.07.31.17 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Nov 2015 07:31:17 -0800 (PST) Subject: Re: /bin/ls formatting broken for non-C(?) locales To: Baptiste Daroussin References: <20151120122352.GA5751@stack.nl> <20151121003541.GF21071@ivaldir.etoilebsd.net> <5650DACA.2090501@freebsd.org> <20151125001513.GC70014@ivaldir.etoilebsd.net> <56550F69.8050609@freebsd.org> <20151125125325.GB77370@ivaldir.etoilebsd.net> <5655B8D9.8060805@freebsd.org> <20151125135059.GC77370@ivaldir.etoilebsd.net> <5655C059.8010701@freebsd.org> <20151125143501.GD77370@ivaldir.etoilebsd.net> <5655CFC6.7010805@freebsd.org> Cc: Ed Schouten , Jilles Tjoelker , "Sergey V. Dyatko" , FreeBSD Current From: Andrey Chernov Message-ID: <5655D444.1050901@freebsd.org> Date: Wed, 25 Nov 2015 18:31:16 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5655CFC6.7010805@freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6nvnRbobn61DaVsGeJX1Q82hKaGq0dNca" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2015 15:31:21 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6nvnRbobn61DaVsGeJX1Q82hKaGq0dNca Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 25.11.2015 18:12, Andrey Chernov wrote: > On 25.11.2015 17:35, Baptiste Daroussin wrote: >>> BTW, array size looks suspicious: >>> static wchar_t wab_months[12][MAX_ABMON_WIDTH * 2 * MB_LEN_MAX]; >>> what MB_LEN_MAX doing here? This constant is for multiple-bytes encod= ed, >>> not for wide chars. >> Bad copy/paste sorry it should be "MAX_ABMON_WIDTH * 2" >=20 > I don't check deep enough, it seems first array > MAX_ABMON_WIDTH * MB_LEN_MAX + 1 > and second one > MAX_ABMON_WIDTH * 2 + 1 >=20 No. We can't assume anything here and should integrate limits from the locale for months fields instead. F.e. in abstract general case in wide array can be 100 zero-width characters + 5 of normal characters, so width-oriented sizes not prevents overflowing. First array size should be from locale internals, second one =3D=3D first * sizeof(wchar_t) it will be safe for not overflowing. --=20 http://ache.vniz.net/ --6nvnRbobn61DaVsGeJX1Q82hKaGq0dNca Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJWVdRFAAoJEKUckv0MjfbKRAAIALIDShwfnPee9sDd/y88jWQW fJZ2ADPaciWeFoNSIjf0We/+eDYVKv8zrZ/P0pAAsR8kxQXS+n9+Y3tU2bUfhIOJ ux7eyLAKQSoKCBS+7O88euAxK9Dfape6W6qKD4M1PNXStMhPJRJwndCopsidRGx+ dfo+1zVnaUklsj2FwPlN0VphKOLgzP86QRh/JochaDZioakPIgTViLVM7LCfSzLa qyHoHunxcmIF689MpbWvbzjiPIbBzxNqsaExEuYkpdkhc2dTu2QdNEp7vKFV2rWZ iqyq0b3EyELTuLllXLMR8jOPtAhVH2CQCUBICMQ1RkILC1kvYTaPUg0oMn6Q6Hk= =7bOv -----END PGP SIGNATURE----- --6nvnRbobn61DaVsGeJX1Q82hKaGq0dNca--