date-time library and checked iterators 2
Dear all, I post half year ago about a problem in the Boost.DateTime library but never got an answer. So I try again: 'the date_facet::do_put_tm' fct. contains an illegal dereferncing in '&*a_format.begin()'. If the a_format string is empty VS2008 complains (and terminates) about illegal iterator dereference. I suspect though that VS2008 is right. Is it possible that this gets attention, or is something else wrong? Wkr, me
Hi, I won't be able to fix the problem if it is in the boost library, I am afraid, but I could try to help narrowing it down. If there is a bug in the boost code, you should file a bug report. Could you send a short sample code which should compile but does not (~10 lines)? Which boost version are you using? Regards, Roland gast128 wrote:
Dear all,
I post half year ago about a problem in the Boost.DateTime library but never got an answer. So I try again: 'the date_facet::do_put_tm' fct. contains an illegal dereferncing in '&*a_format.begin()'. If the a_format string is empty VS2008 complains (and terminates) about illegal iterator dereference. I suspect though that VS2008 is right. Is it possible that this gets attention, or is something else wrong?
Wkr, me
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi,
I won't be able to fix the problem if it is in the boost library, I am afraid, but I could try to help narrowing it down. If there is a bug in the boost code, you should file a bug report. I don't know how to. Even so a previous attempt was unsuccesful. I got a strange http error (the last time).
Could you send a short sample code which should compile but does not (~10 lines)?
Code compiles but gives a runtime error (through the checked iterators): // use time_put facet to create final string 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());
Which boost version are you using? 1.37
Code compiles but gives a runtime error (through the checked iterators):
// use time_put facet to create final string 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());
ok, sorry, should have been more specific there: Could you send a short but "complete" sample which compiles but crashes? It should contain a main function which does serves only one purpose: Demonstrate the problem in as little code as possible (but as much as necessary to actually be able to create a program from it). Something like this would be useful to attach to a bug report, too. Filing a bug report should work (never had a problem), starting from here: http://www.boost.org/support/bugs.html Regards, Roland
Roland Bock <rbock <at> eudoxos.de> writes:
Code compiles but gives a runtime error (through the checked iterators):
// use time_put facet to create final string 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());
ok, sorry, should have been more specific there: Could you send a short but "complete" sample which compiles but crashes? It should contain a main function which does serves only one purpose: Demonstrate the problem in as little code as possible (but as much as necessary to actually be able to create a program from it).
Something like this would be useful to attach to a bug report, too.
I already understood that the first time. However it takes me some time to peal of the unnessary parts to create a test case, since it happens during streaming of a date time when a facet is set. However from the Date.Time code one can clearly see that it is incorrect. This is only allowed if the specifications explicitly state that the format string may not be empty.
Filing a bug report should work (never had a problem), starting from here:
I got an error about an invalid certificate, but maybe I will give it a try.
gast128 wrote:
I already understood that the first time. However it takes me some time to peal of the unnessary parts to create a test case, since it happens during streaming of a date time when a facet is set. However from the Date.Time code one can clearly see that it is incorrect. This is only allowed if the specifications explicitly state that the format string may not be empty.
Yes, that definitely looks like it is wrong. Still, it would be good to have a small sample to demonstrate.
I got an error about an invalid certificate, but maybe I will give it a try.
Ah, ok, the bug repository is hosted on an https. The server's certificate has not been registered at one of the VeriSign or Thawte or other certificate authorities. If this happened at your bank or an internet shop, it would be a reason to stop. But here you just want to file a bug report. There is no risk in accepting the certificate (and your browser should offer some button to do so). Regards, Roland
I have created a case: #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; } I will post it if possible. (thx btw)
filed a bug report (ticket 2698) and it was solved within an hour for Boost 1.38
participants (2)
-
gast128
-
Roland Bock