RTEMS | objectinitializeinformation.c: Coverity spotted possible over indexing (#5084)
Joel Sherrill (@joel)
gitlab at rtems.org
Fri Aug 2 16:13:30 UTC 2024
Joel Sherrill created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5084
Assignee: Joel Sherrill
## Summary
Coverity flagged a spot where the _Objects_Information_table may be used with an index that is too large. However, this method is only used during initialization and the API and class fields passed should be able to be trusted. In light of this, the decision was made to add an _Assert which will let Coverity Scan know it is accounted for.
Coverity CID 1512508
```
71 /*
72 * Register this Object Class in the Object Information Table.
73 */
CID 1512508: (#1 of 1): Out-of-bounds read (OVERRUN)
1. overrun-local: Overrunning array _Objects_Information_table of 4 4-byte elements at element index 7 (byte offset 31) using index _Objects_Get_API(maximum_id) (which evaluates to 7).
74 _Objects_Information_table[ _Objects_Get_API( maximum_id ) ]
75 [ _Objects_Get_class( maximum_id ) ] = information;
```
## Steps to reproduce
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5084
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20240802/14f3e6d5/attachment.htm>
More information about the bugs
mailing list