This release includes important bugfixes, defensive checks, improved code quality, and more tests. Although not public, the fuzzer was also improved by adding more fuzz tests.
:lady_beetle: Bug fixes related to the keyasint feature
These changes only affect Go struct fields tagged with keyasint:
- [Decoding] Reject integer keys that exceed
math.MaxInt64when decoding CBOR map to a struct withkeyasintfield (PR #757) - [Decoding] Prevent string representation of an integer key from matching the struct field tagged by keyasint (PR #757)
- [Encoding & Decoding] Deduplicate struct fields with the same normalized
keyasinttag values (PR #757)
:lady_beetle: Other bug fixes and defensive checks
Some of the bugs fixed are related to decoding extreme values that cannot be encoded with this library. For example, the decoder checks if epoch time encoded as CBOR float value representing hundreds of billions of years overflows int64(seconds).
NOTE: It is generally good practice to avoid using floating point to store epoch time (even when not using CBOR).
- [Decoding] Reject decoding epoch time encoded as floats that overflow int64 (PR #753)
- [Encoding] Return a cloned slice for an empty
RawMessagefromRawMessage.MarshalCBOR(PR #753) - [Encoding] Reject encoding nil inside indefinite-length strings (PR #750)
- [Diagnostic] Accept valid
U+FFFDreplacement character (PR #753)
What's Changed
- :new: Add TimeMode encoding option
TimeRFC3339NanoUTCby @fxamacker in https://github.com/fxamacker/cbor/pull/688 - Use actual negative zero in tests by @makew0rld in https://github.com/fxamacker/cbor/pull/708
- Reject encoding nil inside CBOR indefinite-length string by @fxamacker in https://github.com/fxamacker/cbor/pull/750
- Refactor and add tests by @fxamacker in https://github.com/fxamacker/cbor/pull/752
- Small bugfixes, defensive checks, and improvements by @fxamacker in https://github.com/fxamacker/cbor/pull/753
- Refactor parseMapToStruct(), getDecodingStructType(), getEncodingStructType(), and field struct by @fxamacker in https://github.com/fxamacker/cbor/pull/754
- Fix several issues related to keyasint tag option by @fxamacker in https://github.com/fxamacker/cbor/pull/757
CI / GitHub Actions and Docs
:mag_right: Details...
- Bump github/codeql-action from 3.29.2 to 3.29.4 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/690
- Bump github/codeql-action from 3.29.4 to 3.29.5 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/691
- Bump actions/checkout from 4.2.2 to 5.0.0 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/696
- Bump github/codeql-action from 3.29.7 to 3.29.9 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/697
- Bump github/codeql-action from 3.29.9 to 3.29.11 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/700
- Bump github/codeql-action from 3.29.11 to 3.30.0 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/702
- Bump actions/setup-go from 5.5.0 to 6.0.0 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/703
- Bump github/codeql-action from 3.30.0 to 3.30.3 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/706
- Bump github/codeql-action from 3.30.3 to 3.30.4 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/710
- Bump github/codeql-action from 3.30.4 to 3.30.6 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/712
- Bump github/codeql-action from 3.30.6 to 4.30.7 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/713
- Bump github/codeql-action from 4.30.7 to 4.30.8 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/716
- Bump github/codeql-action from 4.30.8 to 4.30.9 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/718
- Bump github/codeql-action from 4.30.9 to 4.31.2 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/720
- Bump github/codeql-action from 4.31.2 to 4.31.3 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/721
- Bump github/codeql-action from 4.31.3 to 4.31.4 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/724
- Bump actions/setup-go from 6.0.0 to 6.1.0 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/725
- Bump actions/checkout from 5.0.0 to 6.0.0 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/726
- Bump github/codeql-action from 4.31.4 to 4.31.5 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/727
- Bump github/codeql-action from 4.31.5 to 4.31.6 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/728
- Bump actions/checkout from 6.0.0 to 6.0.1 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/729
- Bump github/codeql-action from 4.31.6 to 4.31.8 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/732
- Bump github/codeql-action from 4.31.8 to 4.31.9 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/733
- Bump github/codeql-action from 4.31.9 to 4.31.10 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/738
- Bump actions/setup-go from 6.1.0 to 6.2.0 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/739
- Bump actions/checkout from 6.0.1 to 6.0.2 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/740
- Bump github/codeql-action from 4.31.10 to 4.32.0 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/742
- Bump github/codeql-action from 4.32.0 to 4.32.3 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/745
- Bump actions/setup-go from 6.2.0 to 6.3.0 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/746
- Bump github/codeql-action from 4.32.3 to 4.32.4 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/747
- Bump github/codeql-action from 4.32.4 to 4.32.6 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/748
- Bump github/codeql-action from 4.32.6 to 4.34.0 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/749
- Bump github/codeql-action from 4.34.0 to 4.34.1 by @dependabot[bot] in https://github.com/fxamacker/cbor/pull/751
- Update README status section by @fxamacker in https://github.com/fxamacker/cbor/pull/758
New Contributors
- @makew0rld made their first contribution in https://github.com/fxamacker/cbor/pull/708
Full Changelog: https://github.com/fxamacker/cbor/compare/v2.9.0...v2.9.1