mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
arinc653: avoid array overrun
Incrementing ->sched_index between bounds check and array access may result in accessing one past the array when that is fully filled (->num_schedule_entries == ARINC653_MAX_DOMAINS_PER_SCHEDULE). Fixes:22787f2e10("ARINC 653 scheduler") Reported-by: Kamil Frankowicz <kamil.frankowicz@cert.pl> Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Juergen Gross <jgross@suse.com> Reviewed-by: Stewart Hildebrand <stewart@stew.dk> master commit:5a1121633fmaster date: 2026-03-26 10:47:41 +0100
This commit is contained in:
1 parent
b96452cf85
commit
f1826fa6eb
1 file changed
+1
-4
@@ -550,12 +550,9 @@ a653sched_do_schedule(
|
||||
|
||||
/* Switch minor frame or find correct minor frame after a miss */
|
||||
while ( (now >= sched_priv->next_switch_time) &&
|
||||
(sched_priv->sched_index < sched_priv->num_schedule_entries) )
|
||||
{
|
||||
sched_priv->sched_index++;
|
||||
(++sched_priv->sched_index < sched_priv->num_schedule_entries) )
|
||||
sched_priv->next_switch_time +=
|
||||
sched_priv->schedule[sched_priv->sched_index].runtime;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we exhausted the domains in the schedule and still have time left
|
||||
|
||||