Skip to content

Fix compiler and ubsan warnings#359

Merged
pariterre merged 4 commits into
pyomeca:devfrom
smnnlt:fixes
Apr 24, 2025
Merged

Fix compiler and ubsan warnings#359
pariterre merged 4 commits into
pyomeca:devfrom
smnnlt:fixes

Conversation

@smnnlt
Copy link
Copy Markdown
Contributor

@smnnlt smnnlt commented Apr 23, 2025

While working on the R implementation of ezc3d I found some compiler and ubsan warnings generated by the C++ source code. I tried to remove them by making the following modification:

  • Avoid integer overflow in hex2uint and hex2int by disregarding extra bytes. Also using bit shifting which should be faster and safer (0f99702)
  • Catch by reference not by value in various functions (81b7345)
  • Remove an unused variable in ezc3d::DataNS::AnalogsNS::Info::Info (61945bb)
  • Fix correct comparison of signed and unsigned integers in ezc3d::c3d::frames (86f2bf6)

I have yet to get used to the test suite, so I have not tested the modifications so far (apart from the R implementation, where I could remove the warnings and the code still works as intended).


This change is Reviewable

Copy link
Copy Markdown
Member

@pariterre pariterre left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 11 of 11 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @smnnlt)

@pariterre
Copy link
Copy Markdown
Member

Sweet again :) Thank for you help!

@pariterre pariterre merged commit 2c82ef1 into pyomeca:dev Apr 24, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants