Repository navigation
In cbor2cjson.c example, add missing cbor_move to cbor_array_get call - #338
Merged
Merged
Conversation
Owner
|
Good catch, thanks for the fix @whitehse ! |
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
Mar 30, 2025
0.12.0 (2025-03-16) - BUILD BREAKING: [Respect `INTERPROCEDURAL_OPTIMIZATION` and use the default value](PJK/libcbor#315) - BREAKING: Changes to NaN encoding - [Fix NaN encoding on Windows](PJK/libcbor#271) - [Fix NaN encoding on mips/mipsel](PJK/libcbor#329) - [Signaling NaNs will from now on be encoded as canonical quiet NaNs](PJK/libcbor#335). This was already the existing behavior for half-precision floats - Decoding is unchanged - Please note that this is an intermediate state and likely to be revisited (PJK/libcbor#336) - [Make build compatible with CMake FetchContent](PJK/libcbor#341) (by [Jan200101](https://github.com/Jan200101)) - [Support Bzlmod for Bazel builds](PJK/libcbor#340) - This should significantly simplify including libcbor as a dependency/module in Bazel projects, see https://bazel.build/external/migration - Code quality improvements - [Fix compiler pragmas](PJK/libcbor#347) (by [brooksdavis](https://github.com/brooksdavis)) - [Fix code style issues](PJK/libcbor#321) - [Fixed bug in cbor2cjson example](PJK/libcbor#338)
msk
pushed a commit
to msk/pkgsrc
that referenced
this pull request
May 11, 2026
0.12.0 (2025-03-16) - BUILD BREAKING: [Respect `INTERPROCEDURAL_OPTIMIZATION` and use the default value](PJK/libcbor#315) - BREAKING: Changes to NaN encoding - [Fix NaN encoding on Windows](PJK/libcbor#271) - [Fix NaN encoding on mips/mipsel](PJK/libcbor#329) - [Signaling NaNs will from now on be encoded as canonical quiet NaNs](PJK/libcbor#335). This was already the existing behavior for half-precision floats - Decoding is unchanged - Please note that this is an intermediate state and likely to be revisited (PJK/libcbor#336) - [Make build compatible with CMake FetchContent](PJK/libcbor#341) (by [Jan200101](https://github.com/Jan200101)) - [Support Bzlmod for Bazel builds](PJK/libcbor#340) - This should significantly simplify including libcbor as a dependency/module in Bazel projects, see https://bazel.build/external/migration - Code quality improvements - [Fix compiler pragmas](PJK/libcbor#347) (by [brooksdavis](https://github.com/brooksdavis)) - [Fix code style issues](PJK/libcbor#321) - [Fixed bug in cbor2cjson example](PJK/libcbor#338)
jperkin
pushed a commit
to TritonDataCenter/pkgsrc
that referenced
this pull request
May 14, 2026
0.12.0 (2025-03-16) - BUILD BREAKING: [Respect `INTERPROCEDURAL_OPTIMIZATION` and use the default value](PJK/libcbor#315) - BREAKING: Changes to NaN encoding - [Fix NaN encoding on Windows](PJK/libcbor#271) - [Fix NaN encoding on mips/mipsel](PJK/libcbor#329) - [Signaling NaNs will from now on be encoded as canonical quiet NaNs](PJK/libcbor#335). This was already the existing behavior for half-precision floats - Decoding is unchanged - Please note that this is an intermediate state and likely to be revisited (PJK/libcbor#336) - [Make build compatible with CMake FetchContent](PJK/libcbor#341) (by [Jan200101](https://github.com/Jan200101)) - [Support Bzlmod for Bazel builds](PJK/libcbor#340) - This should significantly simplify including libcbor as a dependency/module in Bazel projects, see https://bazel.build/external/migration - Code quality improvements - [Fix compiler pragmas](PJK/libcbor#347) (by [brooksdavis](https://github.com/brooksdavis)) - [Fix code style issues](PJK/libcbor#321) - [Fixed bug in cbor2cjson example](PJK/libcbor#338)
tsutsui
pushed a commit
to tsutsui/pkgsrc
that referenced
this pull request
Oct 17, 2026
0.12.0 (2025-03-16) - BUILD BREAKING: [Respect `INTERPROCEDURAL_OPTIMIZATION` and use the default value](PJK/libcbor#315) - BREAKING: Changes to NaN encoding - [Fix NaN encoding on Windows](PJK/libcbor#271) - [Fix NaN encoding on mips/mipsel](PJK/libcbor#329) - [Signaling NaNs will from now on be encoded as canonical quiet NaNs](PJK/libcbor#335). This was already the existing behavior for half-precision floats - Decoding is unchanged - Please note that this is an intermediate state and likely to be revisited (PJK/libcbor#336) - [Make build compatible with CMake FetchContent](PJK/libcbor#341) (by [Jan200101](https://github.com/Jan200101)) - [Support Bzlmod for Bazel builds](PJK/libcbor#340) - This should significantly simplify including libcbor as a dependency/module in Bazel projects, see https://bazel.build/external/migration - Code quality improvements - [Fix compiler pragmas](PJK/libcbor#347) (by [brooksdavis](https://github.com/brooksdavis)) - [Fix code style issues](PJK/libcbor#321) - [Fixed bug in cbor2cjson example](PJK/libcbor#338)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The cbor2cjson.c example contains a call to cbor_array_get, which increments the reference counter, that is not paired with a cbor_move or reference decrement.
I borrowed the cbor_to_cjson function in some test code that was exhibiting a memory leak, until I added a cbor_move call:
https://github.com/whitehse/testing/blob/master/ipfix/ipfix_server.c
There are two kinds of arrays in my test data. I don't know if one or both kinds are triggering an issue:
Since this is example code, I have not updated any tests, documentation, or the CHANGELOG. There are no security or performance implications in this one-line change.
Checklist