Re: [Cbor] Invalid decimal fraction / big float?

Laurence Lundblade <lgl@island-resort.com> Sun, 25 August 2019 19:22 UTC

Return-Path: <lgl@island-resort.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E86A8120058 for <cbor@ietfa.amsl.com>; Sun, 25 Aug 2019 12:22:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.896
X-Spam-Level:
X-Spam-Status: No, score=-1.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
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 55hgVS0KLHg5 for <cbor@ietfa.amsl.com>; Sun, 25 Aug 2019 12:22:08 -0700 (PDT)
Received: from p3plsmtpa06-04.prod.phx3.secureserver.net (p3plsmtpa06-04.prod.phx3.secureserver.net [173.201.192.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 45F7C120026 for <cbor@ietf.org>; Sun, 25 Aug 2019 12:22:08 -0700 (PDT)
Received: from [192.168.1.76] ([76.167.193.86]) by :SMTPAUTH: with ESMTPA id 1y5WilZwuuLel1y5XikQnC; Sun, 25 Aug 2019 12:22:07 -0700
From: Laurence Lundblade <lgl@island-resort.com>
Message-Id: <39C91AF6-7948-46E4-8FDA-F1F8188A107D@island-resort.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_5C1A4C90-F90B-4FF9-AF1D-A3AAEE7F03F6"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Date: Sun, 25 Aug 2019 12:22:06 -0700
In-Reply-To: <0515B626-7968-43C1-950E-5AD5FCEA2671@tzi.org>
Cc: cbor@ietf.org
To: Carsten Bormann <cabo@tzi.org>
References: <D4C38A34-F601-4173-A686-362DDE4E8BEE@island-resort.com> <0515B626-7968-43C1-950E-5AD5FCEA2671@tzi.org>
X-Mailer: Apple Mail (2.3445.104.11)
X-CMAE-Envelope: MS4wfIQrbBqsV05Kdb7Op9XI5SmSBjRcwQz6svFM+JlFmQW4eVWLijy6ho4po7dVJVbA3uBrcL4W8SiT8fW8ZBfcCqZKjv6P8L3/GAfvKBXnwWGCpGYwDCJb I677t3/GMLEnRN9pcYa+HwFE9z7QmgdXNVBKFZmRGcJzd/hdNmhcc9o6rtsxHX4YRau5L5LqFkMB9A==
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/JDPB4aLsYjf__w3_noCl7Ci9KgI>
Subject: Re: [Cbor] Invalid decimal fraction / big float?
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 25 Aug 2019 19:22:10 -0000


> On Aug 25, 2019, at 6:19 AM, Carsten Bormann <cabo@tzi.org> wrote:
> 
> On Aug 25, 2019, at 11:57, Laurence Lundblade <lgl@island-resort.com> wrote:
>> 
>> My inclination would be that they are both valid. If that is the choice, then decoders MUST handle both and that is not obvious from the text.
> 
> The intent (and the text) of RFC 7049 require that the second element of the array is either a basic integer (major type 0/1) or a tag 2/3 bignum.  
> 
> The meaning of your example with a byte string in that position may be clear to you, but it isn’t to me.  (It also isn’t allowed by RFC 7049.)  I would not propose that we start assigning that meaning to it after the fact.

OK. Tag 2/3 is required. 

It seemed worth checking to me because of 1) comments and emails during the recent Prague meeting about tags being hints and optional and 2) CWT expressly forbidding them. Wanted to be sure there was no assumptions being made. 

There seems to be no rule about when tags are present or not. Each protocol gets to decide between:
a) required — for example decimal fraction
b) forbidden — for example time CWT
c) optional — (I don’t know of an example)

A good generic decoders will handle all three, probably with some feature in the API to say which of the above scenarios to use.

But understood that a decimal fraction with an untagged big num is invalid.

LL