Skip to content

Commit

Permalink
fix: add tas vector param count validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzyhau committed Jul 6, 2023
1 parent 6b3fc75 commit 64137af
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Features/Tas/TasParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,19 @@ static Vector parseVector(const Line &line, size_t idx) {
else if (t1.type == TasToken::FLOAT) vec.y = t1.f;
else throw TasParserException(Utils::ssprintf("expected vector B %d '%s'", (int)t1.type, t1.tok.c_str()));

if (idx + 2 < line.tokens.size()) {
auto &t3 = line.tokens[idx + 2];
switch (t3.type) {
case TasToken::PIPE:
break;
case TasToken::INTEGER:
case TasToken::FLOAT:
throw TasParserException("invalid vector param count");
default:
throw TasParserException(Utils::ssprintf("expected end of vector, found '%s'", t3.tok.c_str()));
}
}

return vec;
}

Expand Down

0 comments on commit 64137af

Please sign in to comment.