Access Violation in std::pair

Posted by sameer karjatkar on Stack Overflow See other posts from Stack Overflow or by sameer karjatkar
Published on 2010-05-20T06:24:58Z Indexed on 2010/05/20 12:00 UTC
Read the original article Hit count: 309

Filed under:
|

I have an application which is trying to populate a pair. Out of nowhere the application crashes.

The Windbg analysis on the crash dump suggests:

PRIMARY_PROBLEM_CLASS: INVALID_POINTER_READ

DEFAULT_BUCKET_ID: INVALID_POINTER_READ

STACK_TEXT:
0389f1dc EPFilter32!std::vector<std::pair<unsigned int,unsigned int>,std::allocator<std::pair<unsigned int,unsigned int> > >::size+0xc

INVALID_POINTER_READ_c0000005_Test.DLL!std::vector_std::pair_unsigned_int, unsigned_int_,std::allocator_std::pair_unsigned_int,unsigned_int_____::size

Following is the code snap in the code where it fails:

for (unsigned i1 = 0;  i1 < size1;  ++i1)
{
    for (unsigned i2 = 0;  i2 < size2;  ++i2)
    {
      const branch_info& b1 =  en1.m_branches[i1];   //Exception here :crash 
      const branch_info& b2 =  en2.m_branches[i2];
    }
}

where branch_info is std::pair<unsigned int,unsigned int> and the en1.m_branches[i1] fetches me a pair value.

© Stack Overflow or respective owner

Related posts about stl

Related posts about c++