$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r62751 - branches/release/boost/date_time/local_time
From: andrey.semashev_at_[hidden]
Date: 2010-06-10 13:24:39
Author: andysem
Date: 2010-06-10 13:24:38 EDT (Thu, 10 Jun 2010)
New Revision: 62751
URL: http://svn.boost.org/trac/boost/changeset/62751
Log:
Fixes #4154. Added iterator validity checks. If TZ string is not valid, the time zone constructor throws instead of crashing.
Text files modified: 
   branches/release/boost/date_time/local_time/posix_time_zone.hpp |    21 ++++++++++++++-------                   
   1 files changed, 14 insertions(+), 7 deletions(-)
Modified: branches/release/boost/date_time/local_time/posix_time_zone.hpp
==============================================================================
--- branches/release/boost/date_time/local_time/posix_time_zone.hpp	(original)
+++ branches/release/boost/date_time/local_time/posix_time_zone.hpp	2010-06-10 13:24:38 EDT (Thu, 10 Jun 2010)
@@ -79,9 +79,7 @@
     typedef boost::tokenizer<char_separator_type,
                              typename string_type::const_iterator,
                              string_type> tokenizer_type;
-    typedef typename boost::tokenizer<char_separator_type,
-                             typename string_type::const_iterator,
-                             string_type>::iterator tokenizer_iterator_type;
+    typedef typename tokenizer_type::iterator tokenizer_iterator_type;
 
     //! Construct from a POSIX time zone string
     posix_time_zone_base(const string_type& s) :
@@ -101,11 +99,20 @@
 #endif
       char_separator_type sep(sep_chars);
       tokenizer_type tokens(s, sep);
-      tokenizer_iterator_type it = tokens.begin();
+      tokenizer_iterator_type it = tokens.begin(), end = tokens.end();
+      if (it == end)
+        BOOST_THROW_EXCEPTION(std::invalid_argument("Could not parse time zone name"));
       calc_zone(*it++);
-      if(has_dst_){
-        string_type tmp_str = *it++;
-        calc_rules(tmp_str, *it);
+      if(has_dst_)
+      {
+        if (it == end)
+          BOOST_THROW_EXCEPTION(std::invalid_argument("Could not parse DST begin time"));
+        string_type dst_begin = *it++;
+
+        if (it == end)
+          BOOST_THROW_EXCEPTION(std::invalid_argument("Could not parse DST end time"));
+        string_type dst_end = *it;
+        calc_rules(dst_begin, dst_end);
       }
     }
     virtual ~posix_time_zone_base() {};