Skip to content

Commit

Permalink
Avoid crash in ebpf backend by checking expected IR node kinds (#3427)
Browse files Browse the repository at this point in the history
Signed-off-by: Mihai Budiu <[email protected]>
  • Loading branch information
Mihai Budiu authored Jul 9, 2022
1 parent 9b88fdb commit c770c95
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backends/ebpf/psa/ebpfPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ bool EBPFPipeline::isEmpty() const {
}

auto startState = parser->parserBlock->container->states.at(0);
auto pathExpr = startState->selectExpression->to<IR::PathExpression>()->path;
if (!startState->components.empty() || pathExpr->name.name != IR::ParserState::accept) {
auto path = startState->selectExpression->to<IR::PathExpression>();
if (!path)
return false;
if (!startState->components.empty() || path->path->name.name != IR::ParserState::accept) {
return false;
}

Expand Down

0 comments on commit c770c95

Please sign in to comment.