Re: [Cbor] Question about CBOR padding
Thiago Macieira <thiago.macieira@intel.com> Tue, 06 November 2018 22:25 UTC
Return-Path: <thiago.macieira@intel.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 C153E130DC1 for <cbor@ietfa.amsl.com>; Tue, 6 Nov 2018 14:25:15 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.2
X-Spam-Level:
X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-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 Y-Pfe7cqmIsx for <cbor@ietfa.amsl.com>; Tue, 6 Nov 2018 14:25:13 -0800 (PST)
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 9FD311271FF for <cbor@ietf.org>; Tue, 6 Nov 2018 14:25:12 -0800 (PST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Nov 2018 14:25:11 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.54,473,1534834800"; d="scan'208";a="103980313"
Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by fmsmga004.fm.intel.com with ESMTP; 06 Nov 2018 14:25:11 -0800
Received: from tjmaciei-mobl1.localnet (10.7.197.62) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 6 Nov 2018 14:25:11 -0800
From: Thiago Macieira <thiago.macieira@intel.com>
To: cbor@ietf.org
Date: Tue, 06 Nov 2018 14:25:11 -0800
Message-ID: <3153512.GtUnpKuXoF@tjmaciei-mobl1>
Organization: Intel Corporation
In-Reply-To: <299e007c-10e5-d4cc-afd6-aac45fc3c54a@endpoint.com>
References: <299e007c-10e5-d4cc-afd6-aac45fc3c54a@endpoint.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"
X-Originating-IP: [10.7.197.62]
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/5a_Msj1000D0vQffiwVxOdktoN0>
Subject: Re: [Cbor] Question about CBOR padding
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: Tue, 06 Nov 2018 22:25:16 -0000
On Tuesday, 6 November 2018 13:58:18 PST Matt Vollrath wrote: > Hello list, > > I'm finding CBOR extremely useful for moving large binary blobs > (specifically: ROS point clouds) into browsers via WebSocket. While > hacking on a CBOR integration, I ran into something that the spec > doesn't seem to cover. > > How should CBOR data be padded, if I were to do something weird like > pack it into a PNG? Believe it or not, the previous implementation > packed JSON into PNG with \n padding to complete the last pixel. I > didn't see anything in the spec about padding, except the mention that > UBJSON has an explicit noop code. CBOR has no need for padding and it does not have any byte sequence that can fill in for padding. Some CBOR decoders will simply stop when they've finished reading the one element, ignoring anything remaining in the buffer. If you know this is your case, then simply append anything you want until you reach the boundary you ant. Other decoders will report garbage at the end. If this is a possibility for your file format, you should design your container so you know where the actual CBOR data ends and so you can feed the decoder no padding. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
- [Cbor] Question about CBOR padding Matt Vollrath
- Re: [Cbor] Question about CBOR padding Thiago Macieira
- Re: [Cbor] Question about CBOR padding Michael Richardson
- Re: [Cbor] Question about CBOR padding Carsten Bormann
- Re: [Cbor] Question about CBOR padding Matt Vollrath