Sebastian Huber created a merge request: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1463

Project:Branches: sebhub/rtems:resource-snapshot to rtems/rtos/rtems:main
Author:   Sebastian Huber
Assignee: Sebastian Huber
Reviewer: Joel Sherrill

## Summary

cpukit/libcsupport: Store the member offsets

rtems_resource_snapshot_take() took the address of the scalar member
active_posix_keys and indexed it as an array of 15 elements.  That is
undefined behaviour.  It also bound the order of objects_info_table to
the order of the structure members.  Nothing checked that order.
Coverity reported this as CID 1399703.

Store the offset of the target member in each row of the table.  Take
the offset with offsetof().  Write the active count through that
offset.  Each row names the member it fills, so the order and the
layout of the structure do not matter.  Assert that the structure fits
the offset type.

The public header is unchanged.

Close #5736.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <[email protected]>


## Generative AI

<!-- If you have used AI please use the "AI Contribution" template otherwise 
leave this blank see our fulls statement at 
https://www.rtems.org/generative-ai/-->


<!-- Default settings, if it is a dropdown it will set after submission -->

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1463
You're receiving this email because of your account on gitlab.rtems.org. 
Unsubscribe from this thread: 
https://gitlab.rtems.org/-/sent_notifications/5-1cdimrti3aft1p57niilijdw3-1d/unsubscribe
 | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | 
Help: https://gitlab.rtems.org/help


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to