Commit 96e9fb4
committed
Fix CBOR tag handlers not recognizing tags 0-5 and 21-23
The tagged-item switch in binary_reader::parse_cbor_internal() only handled
head bytes 0xC6-0xD4 and 0xD8-0xDB. Bytes 0xC0-0xC5 (tags 0-5: date/time,
epoch, bignum, decimal, bigfloat) and 0xD5-0xD7 (tags 21-23: base64url,
base64, base16 conversion hints) fell through to the default case and were
reported as invalid bytes, even under cbor_tag_handler_t::ignore and ::store,
despite being valid CBOR major-type-6 tags per RFC 8949.
Add the missing case labels so the full 0xC0-0xDB range is handled
uniformly. Extend the "Tagged values" test in unit-cbor.cpp to cover
0xC0-0xD7, and update the CBOR docs to state the corrected tag range.
Fixes #53151 parent 2e23687 commit 96e9fb4
4 files changed
Lines changed: 25 additions & 5 deletions
File tree
- docs/mkdocs/docs/features/binary_formats
- include/nlohmann/detail/input
- single_include/nlohmann
- tests/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
760 | 760 | | |
761 | 761 | | |
762 | 762 | | |
763 | | - | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
764 | 770 | | |
765 | 771 | | |
766 | 772 | | |
| |||
775 | 781 | | |
776 | 782 | | |
777 | 783 | | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
778 | 787 | | |
779 | 788 | | |
780 | 789 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11309 | 11309 | | |
11310 | 11310 | | |
11311 | 11311 | | |
11312 | | - | |
| 11312 | + | |
| 11313 | + | |
| 11314 | + | |
| 11315 | + | |
| 11316 | + | |
| 11317 | + | |
| 11318 | + | |
11313 | 11319 | | |
11314 | 11320 | | |
11315 | 11321 | | |
| |||
11324 | 11330 | | |
11325 | 11331 | | |
11326 | 11332 | | |
| 11333 | + | |
| 11334 | + | |
| 11335 | + | |
11327 | 11336 | | |
11328 | 11337 | | |
11329 | 11338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2529 | 2529 | | |
2530 | 2530 | | |
2531 | 2531 | | |
2532 | | - | |
| 2532 | + | |
2533 | 2533 | | |
2534 | 2534 | | |
2535 | 2535 | | |
2536 | | - | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
2537 | 2539 | | |
2538 | 2540 | | |
2539 | 2541 | | |
| |||
0 commit comments