Nothing
## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
## -----------------------------------------------------------------------------
library(zucbor)
hex <- function(h) as.raw(strtoi(substring(h, seq(1, nchar(h), 2), seq(2, nchar(h), 2)), 16L))
## -----------------------------------------------------------------------------
tryCatch(cbor_decode(hex("9bffffffffffffffff")),
zucbor_error = function(e) conditionMessage(e))
## -----------------------------------------------------------------------------
cbor_validate(hex("830102"))
tryCatch(cbor_validate(hex("830102"), error = TRUE), zucbor_error = function(e) e$offset)
## -----------------------------------------------------------------------------
deep <- c(rep(as.raw(0x81), 300), as.raw(0x00)) # [[[...[0]...]]]
tryCatch(cbor_decode(deep), zucbor_limit_error = function(e) c(e$limit, e$limit_value))
tryCatch(cbor_decode(hex("83010203"), max_items = 3),
zucbor_limit_error = function(e) class(e)[1])
## -----------------------------------------------------------------------------
cbor_validate(hex("a2010018010000")) # {1: 0, 1: 0}, the second 1 longer
cbor_decode(hex("a2616101616102"), duplicate_keys = TRUE) # {"a": 1, "a": 2}
## -----------------------------------------------------------------------------
cbor_validate(hex("1801"), deterministic = TRUE) # 1 in two bytes
cbor_validate(hex("a203040102"), deterministic = TRUE) # keys out of order
## -----------------------------------------------------------------------------
classify <- function(x) tryCatch({cbor_decode(x); "ok"}, zucbor_error = function(e) class(e)[1])
vapply(list(hex("8201"), hex("61ff"), hex("a201000100"), hex("6100"), hex("0102")), classify, "")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.