diff --git a/Tag.cpp b/Tag.cpp index b0a3b4d..f01cccc 100644 --- a/Tag.cpp +++ b/Tag.cpp @@ -66,6 +66,10 @@ namespace jet { bool finished = false; while(!finished) { in.skipWhitespace(); + // Nothing below makes progress at end of data, so a tag that + // never closes would otherwise loop here forever. + if(in.eod()) + throw coreutils::Exception("unterminated <" + name.str() + "> tag."); if(in.ifNext(">")) { // jet-1.4's real parser knew which built-ins never take // a body (its own "void element" list) - real 1.4 @@ -156,7 +160,8 @@ namespace jet { keywords[keywordName] = in.getTokenExclude(dq ? "\"" : "'"); else throw coreutils::Exception("keyword name must be unique for tag."); - in.ifNext(dq ? "\"" : "'"); + if(!in.ifNext(dq ? "\"" : "'")) + throw coreutils::Exception("unterminated value for " + keywordName.str() + " in <" + name.str() + ">."); } else if(keywordName.getLength() > 0) { // Unquoted attribute value (e.g. TYPE=NE, SCOPE=LOCAL - real // 1.4 content throughout). Neither quote style matched, but