Check SuccessArgsNotificationInfoGet ID count
Validate if the endpoint ID and the vCPU ID fields fit into the
available amount of registers when unpacking
SuccessArgsNotificationInfoGet.
Signed-off-by: Imre Kis <imre.kis@arm.com>
Change-Id: Id5a02cafe5810b55172bf41ad959127906d258e3
diff --git a/src/lib.rs b/src/lib.rs
index 9969247..566cfbe 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -943,6 +943,11 @@
count_of_ids_bits >>= Self::ID_COUNT_BITS;
}
+ let id_field_count = count_of_lists + count_of_ids.iter().sum::<u8>() as usize;
+ if id_field_count > MAX_COUNT {
+ return Err(Error::InvalidNotificationCount);
+ }
+
Ok(Self {
more_pending_notifications: (flags & Self::MORE_PENDING_NOTIFICATIONS_FLAG) != 0,
list_count: count_of_lists,