From 1c53790ca7b8aebbae192668a28cdd4b965bd26f Mon Sep 17 00:00:00 2001 From: sBubshait Date: Wed, 16 Oct 2024 07:58:35 +0100 Subject: [PATCH] Update set_priority to ensure that the new priority is within bounds --- src/threads/thread.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/threads/thread.c b/src/threads/thread.c index 5bca536..4ddee22 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -374,6 +374,9 @@ priority_more (const struct list_elem *a_, const struct list_elem *b_, void thread_set_priority (int new_priority) { + ASSERT (new_priority >= PRI_MIN); + ASSERT (new_priority <= PRI_MAX); + thread_current ()->priority = new_priority; }