|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84645 - trunk/boost/date_time
From: marshall_at_[hidden]
Date: 2013-06-05 16:04:11
Author: marshall
Date: 2013-06-05 16:04:10 EDT (Wed, 05 Jun 2013)
New Revision: 84645
URL: http://svn.boost.org/trac/boost/changeset/84645
Log:
More error checking on tz files; Refs #8391
Text files modified:
trunk/boost/date_time/tz_db_base.hpp | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
Modified: trunk/boost/date_time/tz_db_base.hpp
==============================================================================
--- trunk/boost/date_time/tz_db_base.hpp Tue Jun 4 20:55:37 2013 (r84644)
+++ trunk/boost/date_time/tz_db_base.hpp 2013-06-05 16:04:10 EDT (Wed, 05 Jun 2013) (r84645)
@@ -301,7 +301,16 @@
const char_type sep_char[] = { ';', '\0'};
char_separator_type sep(sep_char);
tokenizer tokens(rule, sep); // 3 fields
-
+
+ if ( std::distance ( tokens.begin(), tokens.end ()) != 3 ) {
+ std::ostringstream msg;
+ msg << "Expecting 3 fields, got "
+ << std::distance ( tokens.begin(), tokens.end ())
+ << " fields in line: " << rule;
+ boost::throw_exception(bad_field_count(msg.str()));
+ BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return false); // should never reach
+ }
+
tokenizer_iterator tok_iter = tokens.begin();
nth = std::atoi(tok_iter->c_str()); ++tok_iter;
d = std::atoi(tok_iter->c_str()); ++tok_iter;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk