[rtems commit] score: Improve heap protection
Sebastian Huber
sebh at rtems.org
Wed Jun 22 14:08:08 UTC 2016
Module: rtems
Branch: master
Commit: 006af6ac76d3dd6248999f097e14d37fed5cf421
Changeset: http://git.rtems.org/rtems/commit/?id=006af6ac76d3dd6248999f097e14d37fed5cf421
Author: Alexander Krutwig <alexander.krutwig at embedded-brains.de>
Date: Tue Jun 14 09:26:12 2016 +0200
score: Improve heap protection
Check block pointers of deferred free list before use.
---
cpukit/score/src/heapallocate.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/cpukit/score/src/heapallocate.c b/cpukit/score/src/heapallocate.c
index a76ac04..77ed582 100644
--- a/cpukit/score/src/heapallocate.c
+++ b/cpukit/score/src/heapallocate.c
@@ -43,9 +43,14 @@
uintptr_t count = 0;
for ( count = 0; count < blocks_to_free_count; ++count ) {
- Heap_Block *next_block_to_free =
- block_to_free->Protection_begin.next_delayed_free_block;
+ Heap_Block *next_block_to_free;
+
+ if ( !_Heap_Is_block_in_heap( heap, block_to_free ) ) {
+ _Heap_Protection_block_error( heap, block_to_free );
+ }
+ next_block_to_free =
+ block_to_free->Protection_begin.next_delayed_free_block;
block_to_free->Protection_begin.next_delayed_free_block =
HEAP_PROTECTION_OBOLUS;
More information about the vc
mailing list