intel / intel/tinycbor

CBOR validation not works

Open
#256 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
630
Forks
222
Avg merge
1d 3h
Merged PRs (30d)
1

Description

hi,

i try to validate my CBOR stream using cbor_value_validate_basic.

i always get error with the first signature tag (even if the stream is ok)
`D9D9F7A300A300196BCF010002C11A3843138001A100F502A100A300F401F93C0002F94D00`

the decoded form is:
```
d9 d9f7 # self describe cbor, tag(55799)
a3 # map(3)
00 # unsigned(0)
a3 # map(3)
00 # unsigned(0)
19 6bcf # unsigned(27,599)
01 # unsigned(1)
00 # unsigned(0)
02 # unsigned(2)
c1 # epoch datetime value, tag(1)
1a 38431380 # unsigned(943,920,000)
# datetime(1999-11-30T00:00:00Z)
01 # unsigned(1)
a1 # map(1)
00 # unsigned(0)
f5 # true, simple(21)
02 # unsigned(2)
a1 # map(1)
00 # unsigned(0)
a3 # map(3)
00 # unsigned(0)
f4 # false, simple(20)
01 # unsigned(1)
f9 3c00 # float(1)
02 # unsigned(2)
f9 4d00 # float(20)
```

if i skip the signature tag before calling cbor_value_validate_basic and introduce a bad map definition (2 declared and 3 items)
`D9D9F7A300**A2**00196BCF010002C11A3843138001A100F502A100A300F401F93C0002F94D00`
The function returns no error.

using [https://cbor.nemo157.com/](url), the stream problem is identified.
`Error: TODO cbor-diag::Error: Remaining bytes (02a100a300f401f93c0002f94d00)`

I have not identified in the lib where can be the problem except after returning, the remaining field is not 0.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.