Boost C++ Libraries: Ticket #2698: date-time library and checked iterators https://svn.boost.org/trac10/ticket/2698 <p> Dear all, </p> <p> posted on the users group, I think the <a class="missing wiki">DateTime</a> library contains a bug. When used with checked iterators, VStudio2008 stops the programming, because an illegal dereference. </p> <p> the date_facet::do_put_tm contains the follwing line: </p> <p> return std::use_facet&lt;std::time_put&lt;CharT&gt; &gt;(a_ios.getloc()).put(next, a_ios, fill_char, &amp;tm_value, &amp;*a_format.begin(), &amp;*a_format.begin()+a_format.size()); </p> <p> if the a_format is empty, dereferencing is illegal according too VStudio2008. Sample program: </p> <p> #include &lt;boost\date_time\gregorian\gregorian.hpp&gt; #include &lt;boost\date_time\posix_time\posix_time.hpp&gt; #include &lt;sstream&gt; </p> <p> int main() { </p> <blockquote> <p> 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; </p> </blockquote> <blockquote> <p> boost::posix_time::time_facet* pFacet = new boost::posix_time::time_facet(""); sstr.imbue(std::locale(std::locale::classic(), pFacet)); </p> </blockquote> <p> </p> <blockquote> <p> sstr &lt;&lt; boost_time; </p> </blockquote> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2698 Trac 1.4.3 Andrey Semashev Thu, 29 Jan 2009 18:54:19 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2698#comment:1 https://svn.boost.org/trac10/ticket/2698#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/50877" title="Removed dereferencing of end iterators of strings, which could cause ...">[50877]</a>) Removed dereferencing of end iterators of strings, which could cause crashes on MSVC. Fixed <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2698" title="#2698: Bugs: date-time library and checked iterators (closed: fixed)">#2698</a>. </p> Ticket