Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56355 - trunk/boost/spirit/home/qi/operator
From: hartmut.kaiser_at_[hidden]
Date: 2009-09-22 13:07:12


Author: hkaiser
Date: 2009-09-22 13:07:10 EDT (Tue, 22 Sep 2009)
New Revision: 56355
URL: http://svn.boost.org/trac/boost/changeset/56355

Log:
Spirit: fixed infinite loop if a Kleene is used inside another Kleene at end of input
Text files modified:
   trunk/boost/spirit/home/qi/operator/kleene.hpp | 7 +++++--
   1 files changed, 5 insertions(+), 2 deletions(-)

Modified: trunk/boost/spirit/home/qi/operator/kleene.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/kleene.hpp (original)
+++ trunk/boost/spirit/home/qi/operator/kleene.hpp 2009-09-22 13:07:10 EDT (Tue, 22 Sep 2009)
@@ -62,8 +62,11 @@
                 value_type;
             value_type val = value_type();
 
- // Repeat while subject parses ok
- while (subject.parse(first, last, context, skipper, val))
+ // Repeat while not at eoi and subject parses ok. We need to check
+ // for eoi as the subject could be another Kleene parser, which
+ // would result in an infinite loop when end of input is reached.
+ while (first != last &&
+ subject.parse(first, last, context, skipper, val))
             {
                 // push the parsed value into our attribute
                 traits::push_back(attr, val);


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