[Boost-bugs] [ boost-Bugs-1518640 ] bug in boost:format

Bugs item #1518640, was opened at 2006-07-07 13:07 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1518640&group_id=7586 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: function Group: None Status: Open Resolution: None Priority: 5 Submitted By: AndreiMS (andreims) Assigned to: Douglas Gregor (dgregor) Summary: bug in boost:format Initial Comment: Hello, software configuration: boost 1.33.1 stlport 5.0 example: std::string ret = boost::str(boost::format("%1%") % std::string("")); If you try to send as first argument the empty string to %-operator then you catch assertion failure in stl code: STLport-5.0.0\stlport\stl/debug/_string.h(308): STL error : Invalid argument to operation (see operation documentation) STLport-5.0.0\stlport\stl/debug/_string.h(308): STL assertion failure: (__s != 0) The null-pointer argument is passed from this: boost/boost/format/feed_args.hpp namespace boost { namespace io { namespace detail { template<class Ch, class Tr, class Alloc> void mk_str( std::basic_string<Ch,Tr, Alloc> & res, const Ch * beg, typename std::basic_string<Ch,Tr,Alloc>::size_type size, std::streamsize w, const Ch fill_char, std::ios_base::fmtflags f, const Ch prefix_space, // 0 if no space-padding bool center) // applies centered/left/right padding to the string [beg, beg+size[ // Effects : the result is placed in res. { typedef typename std::basic_string<Ch,Tr,Alloc>::size_type size_type; res.resize(0); if(w<=0 || static_cast<size_type>(w) <=size) { // no need to pad. res.reserve(size + !!prefix_space); if(prefix_space) res.append(1, prefix_space); res.append(beg, size); /// here "beg" is null } ... ////////////////////-------------------------- There is no assertion failure if you pass empty string as second argument, e.g. std::string ret = boost::str(boost::format("%1% %2%") % 2 % std::string("")); Best regards, Andrei Selikhanovich ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1518640&group_id=7586 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Boost-bugs mailing list Boost-bugs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/boost-bugs
participants (1)
-
SourceForge.net