From 4ed64cf173966d447b9851717a0013bd122d242c Mon Sep 17 00:00:00 2001 From: Themis Demetriades Date: Tue, 15 Oct 2024 10:47:38 +0100 Subject: [PATCH] Add guard in thread_set_priority ensuring priority values are within correct range --- src/threads/thread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/threads/thread.c b/src/threads/thread.c index 30ca2bd..ed305ad 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -354,6 +354,7 @@ thread_foreach (thread_action_func *func, void *aux) void thread_set_priority (int new_priority) { + ASSERT (PRI_MIN <= new_priority && new_priority <= PRI_MAX); thread_current ()->priority = new_priority; }