#20 chunks number and available memory calculated incorrectly

Main_library
closed-fixed
Anton Matosov
5
2008-06-22
2008-06-08
Anton Matosov
No

chunks number and available memory calculated incorrectly, so memory manager can allocate block to memory that is out of memory segment, using of this block can bring access violation error and/or memory corruption

Code below will bring memory corruption

memmgr_type mgr
memory_mgr::manager_traits< memmgr_type >::offset_type ptr;
for( size_t i = 0; i < memory_mgr::manager_traits< memmgr_type >::num_chunks; ++i )
{
ptr = mgr.allocate( memory_mgr::manager_traits< memmgr_type >::chunk_size );
char* p = memory_mgr::detail::char_cast( mgr.get_offset_base() + ptr );
*p = 1;
}

Discussion

  • Anton Matosov
    Anton Matosov
    2008-06-09

    Logged In: YES
    user_id=1814668
    Originator: YES

    unit test implemented in branch 80609.ChunksNumber

     
  • Anton Matosov
    Anton Matosov
    2008-06-09

    • status: open --> open-accepted
     
  • Anton Matosov
    Anton Matosov
    2008-06-22

    Logged In: YES
    user_id=1814668
    Originator: YES

    fixed
    branch: 80609.ChunksNumber
    revision: 318

     
  • Anton Matosov
    Anton Matosov
    2008-06-22

    Logged In: YES
    user_id=1814668
    Originator: YES

    RESOLVED
    branch: trunk
    revision: 320

     
  • Anton Matosov
    Anton Matosov
    2008-06-22

    • status: open-accepted --> closed-fixed