Re: [Json] [Technical Errata Reported] RFC7493 (5354)
Anders Rundgren <anders.rundgren.net@gmail.com> Fri, 11 May 2018 05:01 UTC
Return-Path: <anders.rundgren.net@gmail.com>
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 AAD5412D875 for <json@ietfa.amsl.com>; Thu, 10 May 2018 22:01:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[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, 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 D83rdvuO3OuX for <json@ietfa.amsl.com>; Thu, 10 May 2018 22:01:28 -0700 (PDT)
Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (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 44D3B12D874 for <json@ietf.org>; Thu, 10 May 2018 22:01:27 -0700 (PDT)
Received: by mail-wm0-x241.google.com with SMTP id m129-v6so833588wmb.3 for <json@ietf.org>; Thu, 10 May 2018 22:01:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=95E/piv0e/EUss6GW3G789R0Yc1FpqSeOMkgBJz940o=; b=H25g7ufTc8l9T2ZDlFPAjs4HnchxDmOgEjWm9GuGZfxI91J6BaQ/574k4eRbULPI9y fOWQ7eIuLEbxX5lBsiZPtqwXupIRp06Kb2+Aee0F266GdxWAmtDq1eT57CZJbPfGdNHv g/JIisZnprIb6e3oE25WZ6DuvNJGhlwFx+DKdEsQCf+KZbqlx2ELCK87aEAEwGpykWOg hJxjqUQ9OnSSBW+CJAGMPYBHwStaXE18u4ci3bBE6yS6+kpXfu3EDM6uJwMz7NQzwtl0 t9pWAZpkKUMOEr0ozf5lu1rU1XpuySKkkiI/VOAvlDl9KqOWg9nsKxQdgDe03uVKiE80 VC2w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=95E/piv0e/EUss6GW3G789R0Yc1FpqSeOMkgBJz940o=; b=dofWUSHFKlqsim+DgSWHJl2DZW+MeaGn0bjwCvjA1ntnsiDgVjSAWRJrz9kGvAFC+b GpaqvMCvGL7Ke6RCsy0BlHlt4F0WPcy2paxWQT/Agi4fuu5EIKnLx0wQ/NMcToct0Ck8 SbktiAr6RNBzZgdjixYWGwx6JAdbx6Mf9HlEorKOKgurNYRu4HTPuhy7DHq7eNRqtMQh vcxBZvMzsfbU3amSkvWOthET82CZ3it95Y7/wZSU3e4AmfFGLtCC3d3g/Ul0wTcjeSoF bqC+Dj0GkSn3HjaqNblLp40EebVwJh/4uQR/HQ9N6h2Cwj9LoLN7f0i8SikI8GatIzk6 rlsQ==
X-Gm-Message-State: ALKqPwfw/VMOfWoxnAmZVq2SqdZymvrWBWHEKaXgxxVFQ+sO56IYcdm/ 0/gCWqTUkrvfENEsPuSGDb9r0w==
X-Google-Smtp-Source: AB8JxZrxqRg0rbBXdtq/VP/w1YkT1KNgTmLOdxCDphyq5h+rZVRujzsI0ivkHFKEH/PdKfWLu4GWmA==
X-Received: by 2002:a1c:b656:: with SMTP id g83-v6mr797859wmf.143.1526014885379; Thu, 10 May 2018 22:01:25 -0700 (PDT)
Received: from [192.168.1.79] (25.131.146.77.rev.sfr.net. [77.146.131.25]) by smtp.googlemail.com with ESMTPSA id 19-v6sm788440wmv.18.2018.05.10.22.01.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 May 2018 22:01:24 -0700 (PDT)
To: Joe Hildebrand <hildjj@cursive.net>, json@ietf.org
References: <20180510050214.916C4B81EA7@rfc-editor.org> <4EB0B6DE-2416-4909-9EDA-975439055F33@cursive.net>
From: Anders Rundgren <anders.rundgren.net@gmail.com>
Message-ID: <b23ce436-22c3-17bf-c830-59ee88b9fc2f@gmail.com>
Date: Fri, 11 May 2018 07:01:22 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0
MIME-Version: 1.0
In-Reply-To: <4EB0B6DE-2416-4909-9EDA-975439055F33@cursive.net>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/pYUdtrOXbBHYA9l1tPhu2IATszU>
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: Fri, 11 May 2018 05:01:30 -0000
Right, if you violate the 2**53 limit all bets are off. I don't find that particularly surprising. Using Chrome: > var t = 9007199254740993 > console.log(t) 9007199254740992 In a Java-based tool of mine: setInt53(long value) { if (value < MAX_INT || value > MAX_INT) { throw new IOException("Value out of range:" + value); } Anders On 2018-05-10 21:49, Joe Hildebrand wrote: > 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 >
- [Json] [Technical Errata Reported] RFC7493 (5354) RFC Errata System
- Re: [Json] [Technical Errata Reported] RFC7493 (5… Joe Hildebrand
- Re: [Json] [Technical Errata Reported] RFC7493 (5… Anders Rundgren
- Re: [Json] [Technical Errata Reported] RFC7493 (5… Anders Rundgren
- Re: [Json] [Technical Errata Reported] RFC7493 (5… Carsten Bormann
- Re: [Json] [Technical Errata Reported] RFC7493 (5… Matthew A. Miller