From a5507678e8a1762e465dfe71693f5976510be8ef Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 27 Jul 2015 01:53:32 -0400 Subject: [PATCH] Lexer: ::isDOM failed to enforce minimum size before allowing no endBoundary --- src/Lexer.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 64c8aafa3..181da5d19 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -520,6 +520,7 @@ bool Lexer::isUUID (std::string& token, Lexer::Type& type, bool endBoundary) { std::size_t marker = _cursor; + // Greedy. std::size_t i = 0; for (; i < 36 && marker + i < _eos; i++) { @@ -532,11 +533,11 @@ bool Lexer::isUUID (std::string& token, Lexer::Type& type, bool endBoundary) break; } - if (! endBoundary || - (i >= uuid_min_length && - (_text[marker + i] == 0 || - isWhitespace (_text[marker + i]) || - isSingleCharOperator (_text[marker + i])))) + if (i >= uuid_min_length && + (! endBoundary || + ! _text[marker + i] || + isWhitespace (_text[marker + i]) || + isSingleCharOperator (_text[marker + i]))) { token = _text.substr (_cursor, i); if (! isAllDigits (token))