buffer overflow with boost::program_options
Posted
by f4
on Stack Overflow
See other posts from Stack Overflow
or by f4
Published on 2010-06-15T15:26:22Z
Indexed on
2010/06/15
16:02 UTC
Read the original article
Hit count: 262
Hello,
I have a problem using boost:program_options
this simple program, copy-pasted from boosts' documentation :
#include <boost/program_options.hpp>
int main( int argc, char** argv )
{
namespace po = boost::program_options;
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
("compression", po::value<int>(), "set compression level")
;
return 0;
}
fails with a buffer overflow.
I have activated the "buffer security switch", and when I run it I get an "unknown exception (0xc0000409)" when I step over the line desc.add_options()...
I use Visual Studio 2005 and boost 1.43.0.
By the way it does run if I deactivate the switch but I don't feel comfortable doing so... unless it's possible to deactivate it locally.
So do you have a solution to this problem?
EDIT I found the problem I was linking against libboost_program_options-vc80-mt.lib which wasn't the good library.
© Stack Overflow or respective owner