From owner-svn-src-all@freebsd.org Tue Aug 11 16:28:07 2015 Return-Path: Delivered-To: svn-src-all@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 2B4AC99E0E6 for ; Tue, 11 Aug 2015 16:28:07 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-ob0-f180.google.com (mail-ob0-f180.google.com [209.85.214.180]) (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 F1BA2AAB for ; Tue, 11 Aug 2015 16:28:06 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by obbfr1 with SMTP id fr1so115424149obb.1 for ; Tue, 11 Aug 2015 09:28:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=WPrLko66fTxOJLEbYOvKKl5vie5ABCixgcjWqpI8sxk=; b=CfFfTmz4XOsNwA5pPkeyq7kmIGvkgzVUF7cnPH/jV4Y4a16iZxU6j4wH28NxeTLcmy JrL2n6iBe6hnvGlY5+NbvTLVJCiDWnK5GbYObXIg9WJw8i/Cscu462NT+S3ljeVcqr1l kxUWwMLGf6We6Ii0MQWO9toQKTCpmTMwcDfskIOi8vz7+I3h7wdnUvTwXQHoR0BH64GT 0aEhkm7pemU8d9+4oolyL2YJCZsp0GCcLmXU+i+oIosug53T/u3xVHLtFSuOXyUPVl3B uHXpR8TigMiqYr4bLH3CH/1++vHBVj2iycYXduK8V/c6Q3w3iS0yAkrN2LADEsO701h8 yZsA== X-Gm-Message-State: ALoCoQnZk2oqJAMRNBCFGGPgsK7WQQZBP9TWGpty1k1ANcseCih4WJFAH8fnty3SCnCvjxL1BRiu MIME-Version: 1.0 X-Received: by 10.60.46.200 with SMTP id x8mr26415084oem.73.1439310486215; Tue, 11 Aug 2015 09:28:06 -0700 (PDT) Received: by 10.76.50.84 with HTTP; Tue, 11 Aug 2015 09:28:06 -0700 (PDT) X-Originating-IP: [84.27.222.46] In-Reply-To: <201508090006.t7906vbK031238@repo.freebsd.org> References: <201508090006.t7906vbK031238@repo.freebsd.org> Date: Tue, 11 Aug 2015 18:28:06 +0200 Message-ID: Subject: Re: svn commit: r286491 - head/lib/libc/locale From: Ed Schouten To: Baptiste Daroussin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2015 16:28:07 -0000 2015-08-09 2:06 GMT+02:00 Baptiste Daroussin : > Per rfc3629 value greater than 0x10ffff should be rejected Not only that, values between 0xd800 and 0xdfff also need to be rejected: diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c index 55e2931..8ccfdb1 100644 --- a/lib/libc/locale/utf8.c +++ b/lib/libc/locale/utf8.c @@ -318,6 +318,10 @@ _UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps) lead = 0xc0; len = 2; } else if ((wc & ~0xffff) == 0) { + if (wc >= 0xd800 && wc <= 0xdfff) { + errno = EILSEQ; + return ((size_t)-1); + } lead = 0xe0; len = 3; } else if (wc >= 0 && wc <= 0x10ffff) { -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717