You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the CanardTransfer payload is const void* but is <...> used to free the payload when you are done with it. This leads to const_cast<void*>(transfer->payload) in C++ which is not something you ever want to see. const is part of the API so if you violate the constness you are, technically, entering undefined behaviour.
to which I say:
This is a known issue, yes: https://github.com/UAVCAN/libcanard/blob/2a116170285fb47fcaae150ad21c2ccde0756a5f/libcanard/canard.h#L251-L252
The reason the deallocation function accepts a mutable void* is because the free() from the standard library is defined this way.
We could make it const void* but then if you are using the standard heap or pretty much any other heap manager implemented in C (like o1heap), you will have to cast away your const anyway before calling the deallocation function.
Making o1heapFree() accept a const void would require it to cast away the const also because it has to mutate the returned memory fragment.
Fixing this requires breaking API changes so it is postponed until v2.0.
The text was updated successfully, but these errors were encountered:
* Drop canard_dsdl, use Nunavut instead
* Upgrade CI to LLVM 13
* Actualize license headers
* Support redundant transmission queues and use more consistent public field naming
* Ditch the deprecated canardRxAccept(), rename canardRxAccept2()
* Refactor the API to eliminate the need to cast away const qualifiers; fixes#175
* Tighten up memory checking in the test suite -- add canaries
* Fix race condition in the roundtrip test
* Do not use Catch2 macros from non-main thread because it is not thread-safe
* Support CANARD_CONFIG_HEADER
* CI: add style_check job
* Use AVL tree in the transmission queue
* Remove all linked lists
* Reduce indirection, pointer casts, and memory footprint by exposing the AVL tree in the public API
* Disable C++-specific warnings as they make no sense for a C library
* Add table-based CRC option (#186)
* CI: disable SonarCloud on forks
* Add docker utilities (#187)
* Add acceptance filter configuration helpers (#171)
Co-authored-by: Kalyan Sriram <[email protected]>
@thirtytwobits says:
to which I say:
Fixing this requires breaking API changes so it is postponed until v2.0.
The text was updated successfully, but these errors were encountered: