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
I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.
Describe the bug
The LC_GetSizedWPData function is not using the LC_MultiType_t union properly. It is writing to one member and then reading from another, different member of the same union. This is "type punning" and may not work in an optimized build.
The new version of CppCheck reports this issue.
To Reproduce
Run Cppcheck workflow to see issue.
No known way to actually produce a failure though, as most platforms will behave as the code expects it to, its just not guaranteed to work.
Expected behavior
Should not read from a different union member than was written to.
Code snips
This writes to Unsigned8 but then reads from Signed8:
Additional context
This code does work as intended but is not necessarily safe/portable across platforms in its current form, particularly when optimization is enabled.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered:
Checklist (Please check before submitting)
Describe the bug
The
LC_GetSizedWPData
function is not using theLC_MultiType_t
union properly. It is writing to one member and then reading from another, different member of the same union. This is "type punning" and may not work in an optimized build.The new version of CppCheck reports this issue.
To Reproduce
Run Cppcheck workflow to see issue.
No known way to actually produce a failure though, as most platforms will behave as the code expects it to, its just not guaranteed to work.
Expected behavior
Should not read from a different union member than was written to.
Code snips
This writes to
Unsigned8
but then reads fromSigned8
:LC/fsw/src/lc_watch.c
Lines 854 to 855 in f49a965
Additionally, Many cases write to
Signed32
but onlyUnsigned32
is read here at the end:LC/fsw/src/lc_watch.c
Line 922 in f49a965
System observed on:
N/A
Additional context
This code does work as intended but is not necessarily safe/portable across platforms in its current form, particularly when optimization is enabled.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: