Changeset 99cfdc2d in rtems


Ignore:
Timestamp:
Nov 28, 2000, 9:47:27 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
079b1f4
Parents:
e5aeae7b
Message:

2000-11-28 Chris Johns <ccj@…>

  • src/heapallocate.c: Do not allow the size to overflow when adjusting it. A test allocated a stack of -1 (~0). This actually resulted in a stack being allocated but with a size of 0xb. The allocator did not test the size to see if it rolled through 0 and so allowed the allocation to happen, the thread to get created. The task crashed as you would expect.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/src/heapallocate.c

    re5aeae7b r99cfdc2d  
    4444  void       *ptr;
    4545  unsigned32  offset;
    46  
     46
     47  /*
     48   * Catch the case of a user allocating close to the limit of the
     49   * unsigned32.
     50   */
     51
     52  if ( size >= (-1 - HEAP_BLOCK_USED_OVERHEAD) )
     53    return( NULL );
     54
    4755  excess   = size % the_heap->page_size;
    4856  the_size = size + the_heap->page_size + HEAP_BLOCK_USED_OVERHEAD;
Note: See TracChangeset for help on using the changeset viewer.