2004-07-24 Joel Sherrill <joel@OARcorp.com>

PR 659/rtems
	* score/src/heapsizeofuserarea.c: Check that address specified is in
	the heap.
This commit is contained in:
Joel Sherrill
2004-07-24 17:25:33 +00:00
parent d2511905c5
commit fff1b2068c
2 changed files with 16 additions and 3 deletions

View File

@@ -1,3 +1,9 @@
2004-07-24 Joel Sherrill <joel@OARcorp.com>
PR 659/rtems
* score/src/heapsizeofuserarea.c: Check that address specified is in
the heap.
2004-07-24 Joel Sherrill <joel@OARcorp.com>
PR 652/rtems

View File

@@ -44,10 +44,16 @@ boolean _Heap_Size_of_user_area(
Heap_Block *next_block;
uint32_t the_size;
the_block = _Heap_User_block_at( starting_address );
if ( !_Addresses_Is_in_range(
starting_address, (void *)the_heap->start, (void *)the_heap->final ) )
return( FALSE );
if ( !_Heap_Is_block_in( the_heap, the_block ) ||
_Heap_Is_block_free( the_block ) )
the_block = _Heap_User_block_at( starting_address );
if ( !_Heap_Is_block_in( the_heap, the_block ) )
return( FALSE );
if ( _Heap_Is_block_free( the_block ) )
return( FALSE );
the_size = _Heap_Block_size( the_block );
@@ -60,3 +66,4 @@ boolean _Heap_Size_of_user_area(
*size = the_size;
return( TRUE );
}