Skip to content

Update CBOR references and half-float assertion bounds - #5335

Merged
nlohmann merged 1 commit into
nlohmann:developfrom
Patrick10199:fix-5319-cbor-rfc8949
Jul 30, 2026
Merged

Update CBOR references and half-float assertion bounds#5335
nlohmann merged 1 commit into
nlohmann:developfrom
Patrick10199:fix-5319-cbor-rfc8949

Conversation

@Patrick10199

Copy link
Copy Markdown
Contributor

Summary

  • Correct the CBOR half-precision exponent and mantissa assertion bounds.
  • Update CBOR documentation, comments, and test naming from RFC 7049 to RFC 8949.
  • Regenerate the amalgamated header.

Rationale

The decoder masks the exponent with 0x1F and the mantissa with 0x3FF, so their maximum values are 31 and 1023. The previous bounds of 32 and 1024 could never be reached.

RFC 8949 obsoletes RFC 7049. The existing Appendix D, Figure 3 citation remains valid in RFC 8949. This change corrects debug invariants and stale references without changing CBOR encoding or decoding behavior.

Testing

  • cmake --build build --parallel
  • test-cbor_cpp11 passed.
  • Full local CTest run: 106/109 passed. The three remaining MinGW floating-point parsing failures reproduced unchanged on the unmodified base commit 2e2368709.
  • Formatted with Artistic Style 3.4.13 and regenerated single_include/nlohmann/json.hpp.

Closes #5319

Signed-off-by: Patrick Armstrong <patrick@erpassistant.ai>
@Patrick10199
Patrick10199 marked this pull request as ready for review July 30, 2026 10:11
@Patrick10199
Patrick10199 requested a review from nlohmann as a code owner July 30, 2026 10:11

@nlohmann nlohmann left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@nlohmann nlohmann added this to the Release 3.13.0 milestone Jul 30, 2026
@nlohmann
nlohmann merged commit 868506d into nlohmann:develop Jul 30, 2026
156 checks passed
@nlohmann

Copy link
Copy Markdown
Owner

Thanks!

@patrickarms

patrickarms commented Jul 30, 2026

Copy link
Copy Markdown

Happy to help out! I'll keep poking around and see if there's anything else i can do.

/commented using the wrong account

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CBOR: docs and comments cite the obsoleted RFC 7049, and the half-precision decoder has two tautological assertions

3 participants