Boost logo

Boost Users :

From: boost_at_[hidden]
Date: 2006-02-08 15:20:48


Hello,

there is a bug in the help output generated from

         void format_paragraph(std::ostream& os,
                               std::string par,
                               unsigned first_column_width,
                               unsigned line_length)

function. The error message is cryptic and something like that:

_Myptr + _Off <= (((_Mystring *)this->_Mycont)->_Myptr() + ((_Mystring
*)this->_Mycont)->_Mysize) && _Myptr + _Off >= ((_Mystring
*)this->_Mycont)->_Myptr():

The point is that the new vc8.0 compiler (or better the vs2005 standard
library) performs a lot of additional iterator checking. In the function
format_paragraph the "line_begin" iterator is checked, whether there is
one more line to indent in the help output or whether this is the last
line. During this process, the "line_begin" iterator is incremented
behind the end of the current string "par.end()" and this will trigger
the _SCL_SECURE_VALIDATE_RANGE warning from the new library.

                     if (line_begin + (line_length - indent) > par_end)
                     {
                         line_end = par_end;
                     }

You should be able to trigger this behavior with every application when
printing the help text for an option that is longer than one line.

This new iterator checking has it's pros and cons. While it is good to
find any sort of error, how would you safely write the case above
without reverting to index like operations?

Best regards
Dirk


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net