mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
Add null check for results of dynamic_cast in AssignExpr::TypeCheck. Fixes coverity findings 1403416
and 1403417
This commit is contained in:
parent
40d4004453
commit
0140098adb
1 changed files with 12 additions and 0 deletions
12
src/Expr.cc
12
src/Expr.cc
|
@ -2187,7 +2187,19 @@ bool AssignExpr::TypeCheck(attr_list* attrs)
|
|||
// we can create a new constructor now that the expected type
|
||||
// of LHS is known and let it do coercions where possible.
|
||||
SetConstructorExpr* sce = dynamic_cast<SetConstructorExpr*>(op2);
|
||||
if ( ! sce )
|
||||
{
|
||||
ExprError("Failed typecast to SetConstructorExpr");
|
||||
return false;
|
||||
}
|
||||
|
||||
ListExpr* ctor_list = dynamic_cast<ListExpr*>(sce->Op());
|
||||
if ( ! ctor_list )
|
||||
{
|
||||
ExprError("Failed typecast to ListExpr");
|
||||
return false;
|
||||
}
|
||||
|
||||
attr_list* attr_copy = 0;
|
||||
|
||||
if ( sce->Attrs() )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue