Subject: [Boost-bugs] [Boost C++ Libraries] #2698: date-time library and checked iterators
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-01-29 16:30:23
#2698: date-time library and checked iterators
---------------------------------+------------------------------------------
Reporter: gast128_at_[hidden] | Owner: az_sw_dude
Type: Bugs | Status: new
Milestone: Boost 1.38.0 | Component: date_time
Version: Boost 1.37.0 | Severity: Problem
Keywords: DateTime |
---------------------------------+------------------------------------------
Dear all,
posted on the users group, I think the DateTime library contains a bug.
When used with checked iterators, VStudio2008 stops the programming,
because an illegal dereference.
the date_facet::do_put_tm contains the follwing line:
return std::use_facet<std::time_put<CharT> >(a_ios.getloc()).put(next,
a_ios,
fill_char,
&tm_value,
&*a_format.begin(),
&*a_format.begin()+a_format.size());
if the a_format is empty, dereferencing is illegal according too
VStudio2008. Sample program:
#include <boost\date_time\gregorian\gregorian.hpp>
#include <boost\date_time\posix_time\posix_time.hpp>
#include <sstream>
int main()
{
boost::gregorian::date date(2009, 1, 1);
boost::posix_time::time_duration td(0, 0, 0, 0);
boost::posix_time::ptime boost_time(date, td);
std::stringstream sstr;
boost::posix_time::time_facet* pFacet = new
boost::posix_time::time_facet("");
sstr.imbue(std::locale(std::locale::classic(), pFacet));
sstr << boost_time;
return 0;
}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2698> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC