Bug fix for format library
4 Nov
2002
4 Nov
'02
9:31 a.m.
I found a bug in the format library and fixed it. strm << boost::format("%64.64s") % "hello"; gave an access violation. It was caused by passing an argument greater than the string length to std::string::erase. I added a check so as not to try to erase text that is not there. Here is a diff of my small fix. < is feed_args.hpp from the boost_1_29_0 distribution.
is my fixed file.
158c158,162 < if (specs.truncate_ >= 0) ---
// @@@@@ fjackson 20021022 Added test to make sure we don't call // std::string::erase with an arg greater than the length - this // caused an access violation, noted on outputting a short string // with a %64.64 format specifier. if (specs.truncate_ >= 0 && specs.truncate_ < res.length())
8042
Age (days ago)
8042
Last active (days ago)
0 comments
1 participants
participants (1)
-
Fred Jackson