Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for unassigned/reserved CBOR simple values #370

Merged
merged 2 commits into from
Nov 14, 2022

Conversation

fxamacker
Copy link
Owner

@fxamacker fxamacker commented Oct 10, 2022

Description

This PR adds proper support for all CBOR simple values, including simple values unassigned/reserved by IANA.

  • Add a SimpleValue type which is distinct from Go's numeric types.
  • Add support for properly encoding and decoding all simple values, including 251 unassigned/reserved simple values.
  • Improve support for simple values as map keys by making them distinct from uint64 values.

Closes #372

Background

CBOR simple values are a subset of major type 7 that is not floating-point.

Only 4 simple values were previously supported by this CBOR codec:

  • false
  • true
  • null
  • undefined

The other 251 simple values are unassigned or reserved by IANA.

TODO

  • update comments and godoc
  • fuzz test changes
  • code reviews

EDIT: I will update README in a separate PR.

Add a SimpleValue type which is distinct from Go's numeric types.

Add support for properly encoding and decoding all simple values,
including 251 unassigned/reserved simple values.

Improve support for simple values as map keys by making them
distinct from uint64 values 0-255.

CBOR simple values are a subset of major type 7
that is not floating-point.

Only 4 simple values were previously supported by this codec:
- false
- true
- null
- undefined

The other 251 simple values are unassigned or reserved by IANA.
simplevalue.go Outdated Show resolved Hide resolved
Copy link
Contributor

@x448 x448 left a comment

Choose a reason for hiding this comment

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

LGTM. Would love to see this PR merged if you have time.

@fxamacker
Copy link
Owner Author

Still fuzzing this PR. I'll merge it tonight if no problem is detected by fuzzing.

@fxamacker fxamacker merged commit 7704fa5 into master Nov 14, 2022
@fxamacker fxamacker deleted the fxamacker/support-simple-values branch January 2, 2023 00:06
@fxamacker fxamacker added this to the v2.5.0 milestone May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bugfix+feature: support CBOR simple values that are unsigned/reserved by IANA
2 participants