Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Don’t ref past end of string

fixes #830
Commit
db9866677ebea77fd065248135f084139304a06c
Author
Phil Nash ·
Parents
4101ff314aa0

Files · Download .tar.gz

Changes

 include/external/clara.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/external/clara.h b/include/external/clara.h
index cbcafd56..4200d58f 100644
--- a/include/external/clara.h
+++ b/include/external/clara.h
@@ -554,12 +554,13 @@ namespace Clara {
         }
 
         void parseIntoTokens( std::string const& arg, std::vector<Token>& tokens ) {
-            for( std::size_t i = 0; i <= arg.size(); ++i ) {
+            for( std::size_t i = 0; i < arg.size(); ++i ) {
                 char c = arg[i];
                 if( c == '"' )
                     inQuotes = !inQuotes;
                 mode = handleMode( i, c, arg, tokens );
             }
+            mode = handleMode( arg.size(), '\0', arg, tokens );
         }
         Mode handleMode( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
             switch( mode ) {
@@ -592,6 +593,7 @@ namespace Clara {
                 default: from = i; return ShortOpt;
             }
         }
+
         Mode handleOpt( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
             if( std::string( ":=\0", 3 ).find( c ) == std::string::npos )
                 return mode;