Boost logo

Boost Users :

From: Edson Tadeu (e.tadeu_at_[hidden])
Date: 2006-05-23 12:42:01


If the format string have an absolute tabulation (%t), the
basic_format::clear() method throws an access violation because of this
piece code in format_implementation.hpp(138):

            if( bound_.size()==0 || !bound_[ items_[i].argN_ ] )

Here items_[i].argN_ can be negative (defined in internals.hpp(70)), which
is an invalid index to bound_[].
I think a simple check of greather than zero would suffice to fix it.
Here is a code that catches it:

using boost::format;
format f("%0s%-32.32s:%|40t|%|.6|%|55t|%25s\n");
f % "test1" % 2.0 % "test3";
f % "test4" % 5.0 % "test6"; // calls clear() and breaks



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