
Trent Nelson wrote:
I'd prefer to have a testcase for this bug before fixing it.
The following option triggered the assertion error for me every time:
desc.add_options() ("type,t", po::value<string>()->default_value("manual"), "startup type (\"auto\" or \"manual\") (--install only)"));
If I reduced the description length such that it fit on a single line, the error went away for that particular option (only to crash on a different multiline option down the track).
Thank you. I've comitted a new test that catches this problem, and a fix along the lines of what you've suggested. Thanks, and sorry for being slow with this issue.
Was being caught by the following macro on line 166 of 'C:\Program Files\Microsoft Visual Studio 8\VC\include\xstring':
_Myt& __CLR_OR_THIS_CALL operator+=(difference_type _Off) { // increment by integer if (this->_Mycont != _IGNORE_MYCONT) { _SCL_SECURE_VALIDATE(this->_Mycont != NULL); _SCL_SECURE_VALIDATE_RANGE( _Myptr + _Off <= (((_Mystring *)this->_Mycont)->_Myptr() + ((_Mystring *)this->_Mycont)->_Mysize) && _Myptr + _Off >= ((_Mystring *)this->_Mycont)->_Myptr()); } _Myptr += _Off; return (*this); }
Which makes sense, as it's checking we don't assign past the end of our underlying string, which is exactly what line 395 of options_descriptions.cpp does in multiline conditions.
I'd still consider this check broken, since we never *access* via the invalid iterator, we immediately check if it's past the end and reset it back. Anyway, this is fixed now, both on trunk and release branch. - Volodya