mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
binpac: BIT-1829: throw exceptions for negative array length expressions
This commit is contained in:
parent
455e2fbac5
commit
465fd6bd56
1 changed files with 6 additions and 2 deletions
|
@ -283,8 +283,12 @@ void ArrayType::GenArrayLength(Output *out_cc, Env *env, const DataPtr& data)
|
|||
env->LValue(arraylength_var()));
|
||||
out_cc->inc_indent();
|
||||
out_cc->println("{");
|
||||
out_cc->println("%s = 0;",
|
||||
env->LValue(arraylength_var()));
|
||||
out_cc->println("throw binpac::ExceptionOutOfBound(\"%s\",",
|
||||
data_id_str_.c_str());
|
||||
out_cc->println(" %s, (%s) - (%s));",
|
||||
env->LValue(arraylength_var()),
|
||||
env->RValue(end_of_data),
|
||||
env->RValue(begin_of_data));
|
||||
out_cc->println("}");
|
||||
out_cc->dec_indent();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue