[PATCH v2] cpukit/score: Avoid overflow in multiplication

Kinsey Moore kinsey.moore at oarcorp.com
Wed Jan 17 14:31:47 UTC 2024


Change extend_count to uint32_t from uint16_t to avoid a possible
premature integer overflow when it is later used for multiplication.
---
 cpukit/score/src/objectextendinformation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c
index 414766f219..9a627b1a7c 100644
--- a/cpukit/score/src/objectextendinformation.c
+++ b/cpukit/score/src/objectextendinformation.c
@@ -59,7 +59,7 @@ Objects_Maximum _Objects_Extend_information(
   uint32_t          index_base;
   uint32_t          index_end;
   uint32_t          index;
-  Objects_Maximum   extend_count;
+  uint32_t          extend_count;
   Objects_Maximum   old_maximum;
   uint32_t          new_maximum;
   size_t            object_block_size;
-- 
2.39.2



More information about the devel mailing list