Re: New Version Notification for draft-kamp-httpbis-structure-01.txt (fwd)

Kazuho Oku <kazuhooku@gmail.com> Thu, 17 November 2016 07:21 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1EBCB129498 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 16 Nov 2016 23:21:14 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.998
X-Spam-Level:
X-Spam-Status: No, score=-7.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_SORBS_SPAM=0.5, RP_MATCHES_RCVD=-1.497, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fUUWY71c2aC7 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 16 Nov 2016 23:21:12 -0800 (PST)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CCE101295C2 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Wed, 16 Nov 2016 23:21:12 -0800 (PST)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1c7GxA-00023p-8E for ietf-http-wg-dist@listhub.w3.org; Thu, 17 Nov 2016 07:17:48 +0000
Resent-Date: Thu, 17 Nov 2016 07:17:48 +0000
Resent-Message-Id: <E1c7GxA-00023p-8E@frink.w3.org>
Received: from titan.w3.org ([128.30.52.76]) by frink.w3.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <kazuhooku@gmail.com>) id 1c7Gx3-00022h-5x for ietf-http-wg@listhub.w3.org; Thu, 17 Nov 2016 07:17:41 +0000
Received: from mail-wm0-f47.google.com ([74.125.82.47]) by titan.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <kazuhooku@gmail.com>) id 1c7Gwx-0001PT-56 for ietf-http-wg@w3.org; Thu, 17 Nov 2016 07:17:35 +0000
Received: by mail-wm0-f47.google.com with SMTP id f82so125766523wmf.1 for <ietf-http-wg@w3.org>; Wed, 16 Nov 2016 23:17:14 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=uQ2oryg+fVEYl7bmNMfYwyQswyS8gQAu1YjPdshiVCc=; b=CLPeH0EvGzSC0p5MlHmZUjYznbPQYLGya20i3rUybtE+lrs8/ZgqEBbIw9ElnBGn8j 73M/CxXFmcx2kt0cYNhHMWfuRIvSJDMmK/wKU9P/nBkGPgaboOeHtmVosdv+UhuqImBd QaZ9ZKpBsQByjQOR7MVGAbq49dsLJtc/a5bPTl5LXlto8VQFJW1WRpvvLHDd60SyJSXB utvvNvVh8cbksOHVyO/em6Ya0Ib93FWr3P+QrCkksR0L4Coh1y4pFoD/33eeY3Nv2KT8 A4pOQvlpZVZSDIF6d27v9nVrUPbFJI+P55KT0hdIxxYhd5N8hooGHQ9OE6N/I/VQcEG0 CYAA==
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:from:date :message-id:subject:to:cc; bh=uQ2oryg+fVEYl7bmNMfYwyQswyS8gQAu1YjPdshiVCc=; b=i/BrBE9rCUZ9LgoWVJxfbXKBINeP88AubLcllU8ZthPoYI/BIPNKE0J69uoS3sbhUb oqXd4ash6puQRKE5gIF5pOu3iQwJU66Fi11Au02+lVszmZN55GFpIsWO4piwvB7mXG5R q3qp150UNi0lpl6P4ECt5H6MyODs+COy64nabiXdjYI1JNpY5wqCBFNKOjeG8hw78fIc DKJLKf/1zRWx1qgwdilq3/V7gQlXlZHsm/Av8pxD/hl50b0F165BZetWyDc++hpUAFQv yNbFP/9OrQcjHlXkGPHlcOL1f0Ub696to4H5a15IFBSREmmf9pindAxfN/xDlUCgvjOK vH9A==
X-Gm-Message-State: AKaTC02/f6+LGyPnxgDjMebPbHaaAxkS4T6++XZ4ZGKJ0IO4l+etn0Ei7VZxP/nEDhsSCitbLwgPF5rNrg8ffg==
X-Received: by 10.28.137.193 with SMTP id l184mr2141647wmd.88.1479367028517; Wed, 16 Nov 2016 23:17:08 -0800 (PST)
MIME-Version: 1.0
Received: by 10.194.32.1 with HTTP; Wed, 16 Nov 2016 23:17:07 -0800 (PST)
In-Reply-To: <20161117055345.GB9646@1wt.eu>
References: <78354.1477853918@critter.freebsd.dk> <CANatvzx5RSnnN9ybqh6tRqKV=7NVO+PTpgAuVUU+6JuKGFtczg@mail.gmail.com> <20161117055345.GB9646@1wt.eu>
From: Kazuho Oku <kazuhooku@gmail.com>
Date: Thu, 17 Nov 2016 16:17:07 +0900
Message-ID: <CANatvzwrPxyRPET5SO6fYGZ_6NnqToU9a630x1gjZXx5uAbeuw@mail.gmail.com>
To: Willy Tarreau <w@1wt.eu>
Cc: Poul-Henning Kamp <phk@critter.freebsd.dk>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: text/plain; charset=UTF-8
Received-SPF: pass client-ip=74.125.82.47; envelope-from=kazuhooku@gmail.com; helo=mail-wm0-f47.google.com
X-W3C-Hub-Spam-Status: No, score=-4.3
X-W3C-Hub-Spam-Report: AWL=-0.786, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: titan.w3.org 1c7Gwx-0001PT-56 97a3e1fb97c3c457a2c0b5ff15176181
X-Original-To: ietf-http-wg@w3.org
Subject: Re: New Version Notification for draft-kamp-httpbis-structure-01.txt (fwd)
Archived-At: <http://www.w3.org/mid/CANatvzwrPxyRPET5SO6fYGZ_6NnqToU9a630x1gjZXx5uAbeuw@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/32917
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

Hi,

2016-11-17 14:53 GMT+09:00 Willy Tarreau <w@1wt.eu>eu>:
> Hi Kazuho,
>
> On Thu, Nov 17, 2016 at 10:06:04AM +0900, Kazuho Oku wrote:
>> Hi,
>>
>> Thank you for writing the draft.
>>
>> Regarding the numbers, could we either exclude floating point from the
>> specification or state that an integral number MUST be encoded without
>> using a dot?
>>
>> The reason I ask is because it is hard to correctly implement a parser
>> for floating point numbers, and a bug in the parser would likely lead
>> to a vulnerability [1]. Note that in some (if not most) of the
>> programming languages you would need to implement your own number
>> parser to meet the needs. For example, you cannot use sscanf in C,
>> because depending on the locale the function allows use of decimal
>> points other than '.'.
>>
>> If we could exclude floating point numbers from the specification
>> entirely or have a restriction something like above, parser
>> implementors can refrain from implementing their own floating point
>> number parsers until the specification in which they are interested in
>> actually start using the notation.
>>
>> Non-integral numbers are rarely used in the HTTP headers. The only one
>> I can recall is the q value of Accept-Encoding, but it is not a
>> floating-point but actually a fixed-point number (of three decimals
>> below the point), which could have been represented by using integral
>> numbers between 0 to 1000.
>>
>>      weight = OWS ";" OWS "q=" qvalue
>>      qvalue = ( "0" [ "." 0*3DIGIT ] )
>>             / ( "1" [ "." 0*3("0") ] )
>
> I'd like to avoid FP as well. However it's important to note that fixed
> point numbers is not exempt from similar issues due to the way they are
> encoded, since everyone will store them in floats/doubles,

Yes. Therefore, I believe that the we should discourage people from
using fixed point numbers.

For example, if we want to define a quality value like the one found
in Accept-Encoding, we should not use three-digit fixed point numbers,
but instead use an integral value between 0 to 1000.

That way, we can totally avoid the issues introduced by a dot within a number.

> but the error
> is limited to the mantissa precision. For example 64-bit double numbers
> contain a 53 bit mantissa so we can easily see a difference in the lower
> bits. Example :
>
>   #include <stdio.h>
>   #include <stdlib.h>
>
>   int main(int argc, char **argv)
>   {
>         double f = atof(argv[1]);
>         printf("input=%s float=%f\n", argv[1], f);
>         return 0;
>   }
>
>   $ ./a.out $((1<<32)).000001
>   input=4294967296.000001 float=4294967296.000001
>   $ ./a.out $((1<<33)).000001
>   input=8589934592.000001 float=8589934592.000002
>
> In my opinion we don't care here. And maybe we can document the expected
> minimal precision (eg: minimum 53 bits to be able to store a 32-bit
> integral range with a 1/1000000 fractional precision.
>
> Also it's pretty certain that developers will use atof() on fixed point
> numbers, but at least the input can be sanitized easily by ensuring that
> only digits, dot and - are allowed in it.
>
> Regards,
> Willy



-- 
Kazuho Oku