Sharvin Neve created a merge request: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1478

Project:Branches: Sharvin/rtems:fix-time_t-truncation to rtems/rtos/rtems:main
Author:   Sharvin Neve



Closes #5737.

Coverity reported multiple defects where time_t was assigned or converted
to uint32_t resulting in potential value truncation:

- In `cpukit/libmisc/cpuuse/cpuusagetop.c` (CID 1512539):
  `print_time()` stored the result of `_Timestamp_Get_seconds()` in `uint32_t`,
  causing truncation of 64-bit `time_t`. Decompose time using 64-bit seconds
  with rollover boundary handling (`>=`) and clamp negative timestamps to 0.

- In `cpukit/score/src/schedulercbssetparameters.c`,
  `cpukit/score/src/schedulercbscreateserver.c`, and
  `cpukit/score/src/schedulercbsreleasejob.c` (CID 1512546):
  `Thread_CPU_budget_control.available` is `uint32_t` while
  `Scheduler_CBS_Parameters.budget` is `time_t`. Validate that the budget does
  not exceed `UINT32_MAX` during server creation and parameter updates,
  and explicitly cast upon job budget replenishment.

- In `bsps/shared/dev/getentropy/getentropy-cpucounter.c` (CID 1512551):
  `bintime.sec` was shifted directly as signed `time_t`. Convert through
  unsigned integer prior to 64-bit shift to prevent undefined behavior
  on 32-bit `time_t` architectures.

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1478
You're receiving this email because of your account on gitlab.rtems.org. 
Unsubscribe from this thread: 
https://gitlab.rtems.org/-/sent_notifications/5-egx25673xo3ewssg5bk5hsrp4-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