Copilot commented on code in PR #13650:
URL: https://github.com/apache/trafficserver/pull/13650#discussion_r4076768519
##########
plugins/header_rewrite/parser.cc:
##########
@@ -192,6 +193,11 @@ Parser::preprocess(std::vector<std::string> tokens)
_mods.push_back(m);
}
tokens.pop_back(); // consume it, so we don't concatenate it into the
value
+
+ if (tokens.empty()) {
+ TSError("[%s] modifiers must follow a condition or operator: %s",
PLUGIN_NAME, flags.c_str());
+ return false;
+ }
Review Comment:
This guard still misses the adjacent `cond [L]` form: after the modifier is
popped, `tokens` is `{"cond"}`; the `cond` branch then erases that token and
the later `tokens[0]` access still runs on an empty vector. Reject
modifier-bearing lines that leave no condition operand here as well (and add
that regression case), otherwise malformed config can still crash during load.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]