Buffer Overflow in Release Build

  • Hi Roman,

    i'm using the (most recent version of the) STxxL lib under VC++ 8.0.  I've been using the stxxl::map class for a while now, but it was only recently when strange things started to happen (I don't know why the problems came so late).  My software began to crash for no apparent reason.  The strange thing was that minor changes to the code like exchanging a class or rewriting a small code block seemed to solve the problem, but only for a while.

    What bothered me even more was the fact that the software worked as a Debug build, but not as a Release build.  Unfortunately this didn't make finding the bug easier.  Well, it was pretty clear that the memory wasn't valid anymore.  To cut a long story short, today, I finally made a Release build with all debug information contained, particularly memory checks.  VC++ notified me of a buffer overflow.  As far as I can tell it occurs in the constructor of stxxl::btree::node_cache<...> after the call to block_manager::get_instance().

    Unfortunately I'm not too good at using this information.  I have two stxxl libs, a Debug and a Release build.  As the Debug version seems to work, I thought not optimizing (/O2 -> /Od) the Release lib would maybe solve the problem.  It doesn't...  I'm not even sure if it's STxxL's fault.  Maybe it has to do with one of the Release BOOST libs.

    I will do some more testing, and possibly post the results.  For now I'd be interested in other's opinions.  Has anyone else experienced this?  Any advices or solutions?

    Thanks in advance,

    • I'm sorry.  It was a really strange error (alignment problem), and debugging the whole thing made me believe it had to do with STxxL.  So, sorry.  The problem is not on your side.