Re: [Json] [Technical Errata Reported] RFC7493 (5354)

Joe Hildebrand <hildjj@cursive.net> Thu, 10 May 2018 19:49 UTC

Return-Path: <hildjj@cursive.net>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 44517120724 for <json@ietfa.amsl.com>; Thu, 10 May 2018 12:49:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.489
X-Spam-Level:
X-Spam-Status: No, score=-2.489 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_LOW=-0.7, T_DKIM_INVALID=0.01, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=neutral reason="invalid (public key: not available)" header.d=cursive.net
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 gS7ufQr8N3qM for <json@ietfa.amsl.com>; Thu, 10 May 2018 12:49:51 -0700 (PDT)
Received: from mail-oi0-x22a.google.com (mail-oi0-x22a.google.com [IPv6:2607:f8b0:4003:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4E4E4127136 for <json@ietf.org>; Thu, 10 May 2018 12:49:51 -0700 (PDT)
Received: by mail-oi0-x22a.google.com with SMTP id 11-v6so2812045ois.8 for <json@ietf.org>; Thu, 10 May 2018 12:49:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cursive.net; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=SZQ5Pr6gwRsl3IQFxP7pEP740KPeh3tM2gWQjqrT5jI=; b=LfcLoa9bddDaNEs+iHXcBZG8y+iVeUnc946VNk9ASaAZukUkDinb5eFKA1bd2ta4EH RfUPo6bL1d5ECi/jdh6DNJT2QL95rM//uJM2RMSpO+g/GFD/tgJeXiWCquW/yY3abiDv ExUrrUCllox7t6jAILPrLJqi0TD7aQSYWh25s=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=SZQ5Pr6gwRsl3IQFxP7pEP740KPeh3tM2gWQjqrT5jI=; b=AggzM/7e7Zqq3EDqUaYsP+D3pbhAlGw3A7STYslozVPwFGhIv9ck3Tc+MIsvVJhzEA KlYFz0CGoEqTYmJDwG1J4a1PZTQc7g8QJvSCkPFwp8KhGp8PlV/fsh/wbs0U61GCcH4+ k/pdkPA9YCafwTBGbcusPlPMhOCOxIoA83QhdQisxt2VbpP7YJEIVV55+mvF0v8JZy9F 80shKi4FQ3a/KSZW1tuGEc7VrEQfNHL0PK+RIWQfg+8c64z5C3X4sJNx3c7xQKawk07y 1jER5mITLW9X09OTczR2ovvqlbQn1sKyUdOAAAdvZfhs6oa+QTAE2zJGzr8vTQ7mbrid FFlQ==
X-Gm-Message-State: ALKqPweu5GKYuKg8pnmmRzrhCKj8rTbf4HBxvPqrPRP1/v4hALLGy9G5 SaGa+tr18u493a+8zCVyZcBTNgmlHuo=
X-Google-Smtp-Source: AB8JxZq5pddDOQFdkk0wNRH1p0+Lm7jKVOQP89sfnRPjqnqzFfGBOm3wxoupK/O/5gDi90qbo4ECLA==
X-Received: by 2002:aca:2813:: with SMTP id 19-v6mr1696508oix.281.1525981790245; Thu, 10 May 2018 12:49:50 -0700 (PDT)
Received: from [10.6.16.209] ([128.177.113.102]) by smtp.gmail.com with ESMTPSA id c21-v6sm749268oih.27.2018.05.10.12.49.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 May 2018 12:49:49 -0700 (PDT)
Content-Type: text/plain; charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\))
From: Joe Hildebrand <hildjj@cursive.net>
In-Reply-To: <20180510050214.916C4B81EA7@rfc-editor.org>
Date: Thu, 10 May 2018 13:49:48 -0600
Cc: anders.rundgren.net@gmail.com
Content-Transfer-Encoding: quoted-printable
Message-Id: <4EB0B6DE-2416-4909-9EDA-975439055F33@cursive.net>
References: <20180510050214.916C4B81EA7@rfc-editor.org>
To: json@ietf.org
X-Mailer: Apple Mail (2.3445.6.18)
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/sInBBEt6YJcgXLgMpwSMeHh-XQM>
Subject: Re: [Json] [Technical Errata Reported] RFC7493 (5354)
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 10 May 2018 19:49:53 -0000

I disagree with this pretty thoroughly.  Here is some example NodeJS code to illustrate why:

```js
const START = Number.MAX_SAFE_INTEGER - 2

const buf = Buffer.alloc(8)
for (let i = 0; i < 5; i++) {
  const x = START + i
  buf.writeDoubleBE(x)
  const y = buf.readDoubleBE()
  console.log(`${x} 0x${buf.toString('hex')} ${y} ${x === y}`)
}
```

And its output:

9007199254740989 0x433ffffffffffffd 9007199254740989 true
9007199254740990 0x433ffffffffffffe 9007199254740990 true
9007199254740991 0x433fffffffffffff 9007199254740991 true
9007199254740992 0x4340000000000000 9007199254740992 true
9007199254740992 0x4340000000000000 9007199254740992 true

The point is that Number.MAX_SAFE_INTEGER is that last “integer" that has an unambiguous bit pattern, such that it round trips without the possibility of something else having been intended.


> On May 9, 2018, at 11:02 PM, RFC Errata System <rfc-editor@rfc-editor.org> wrote:
> 
> The following errata report has been submitted for RFC7493,
> "The I-JSON Message Format".
> 
> --------------------------------------
> You may review the report below and at:
> http://www.rfc-editor.org/errata/eid5354
> 
> --------------------------------------
> Type: Technical
> Reported by: Anders Rundgren <anders.rundgren.net@gmail.com>
> 
> Section: 2.2
> 
> Original Text
> -------------
> An I-JSON sender cannot expect a receiver to treat an integer whose
> absolute value is greater than 9007199254740991 (i.e., that is
> outside the range [-(2**53)+1, (2**53)-1]) as an exact value.
> 
> Corrected Text
> --------------
> An I-JSON sender cannot expect a receiver to treat an integer whose
> absolute value is greater than 9007199254740992 (i.e., that is
> outside the range [-(2**53), (2**53)]) as an exact value.
> 
> Notes
> -----
> The limit is presumably derived from ECMAScript which says:
> 
> "The value of Number.MAX_SAFE_INTEGER is the largest integer n such that n and n + 1 are both exactly representable as a Number value"
> 
> However, Number.MAX_SAFE_INTEGER is 9007199254740991.
> 
> Instructions:
> -------------
> This erratum is currently posted as "Reported". If necessary, please
> use "Reply All" to discuss whether it should be verified or
> rejected. When a decision is reached, the verifying party  
> can log in to change the status and edit the report, if necessary. 
> 
> --------------------------------------
> RFC7493 (draft-ietf-json-i-json-06)
> --------------------------------------
> Title               : The I-JSON Message Format
> Publication Date    : March 2015
> Author(s)           : T. Bray, Ed.
> Category            : PROPOSED STANDARD
> Source              : JavaScript Object Notation
> Area                : Applications
> Stream              : IETF
> Verifying Party     : IESG
> 
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json