Ticket #2698 (closed Bugs: fixed)

Opened 8 years ago

Last modified 8 years ago

date-time library and checked iterators

Reported by: gast128@… Owned by: az_sw_dude
Milestone: Boost 1.38.0 Component: date_time
Version: Boost 1.37.0 Severity: Problem
Keywords: DateTime Cc:


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;



Change History

comment:1 Changed 8 years ago by andysem

  • Status changed from new to closed
  • Resolution set to fixed

(In [50877]) Removed dereferencing of end iterators of strings, which could cause crashes on MSVC. Fixed #2698.


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.