mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
binpac: Fixing crash with undefined case expressions.
Found by Emmanuele Zambon.
This commit is contained in:
parent
e7e2ee38e7
commit
d41a2def5a
1 changed files with 5 additions and 0 deletions
|
@ -242,6 +242,11 @@ void Expr::GenCaseEval(Output *out_cc, Env *env)
|
||||||
Type *val_type = DataType(env);
|
Type *val_type = DataType(env);
|
||||||
ID *val_var = env->AddTempID(val_type);
|
ID *val_var = env->AddTempID(val_type);
|
||||||
|
|
||||||
|
// DataType(env) can return a null pointer if an enum value is not
|
||||||
|
// defined.
|
||||||
|
if ( ! val_type )
|
||||||
|
throw Exception(this, "undefined case value");
|
||||||
|
|
||||||
out_cc->println("%s %s;",
|
out_cc->println("%s %s;",
|
||||||
val_type->DataTypeStr().c_str(),
|
val_type->DataTypeStr().c_str(),
|
||||||
env->LValue(val_var));
|
env->LValue(val_var));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue