mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 11:08:20 +00:00
Fix segfault in input framework when reading unset fields
Unset fields could trigger unexpected null pointers in the input manager. This also adds a warning such fields come up.
This commit is contained in:
parent
38d4907903
commit
ef08605877
1 changed files with 14 additions and 0 deletions
|
@ -1073,7 +1073,21 @@ Val* Manager::ValueToIndexVal(const Stream* i, int num_fields, const RecordType
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Bail early here if we already have an error. ValueToVal() won't do
|
||||||
|
// anything in that case, and by checking first we know that if
|
||||||
|
// ValueToVal() returns nullptr, there is a new problem.
|
||||||
|
if ( have_error )
|
||||||
|
break;
|
||||||
|
|
||||||
auto v = ValueToVal(i, vals[position], type->GetFieldType(j).get(), have_error);
|
auto v = ValueToVal(i, vals[position], type->GetFieldType(j).get(), have_error);
|
||||||
|
if ( ! v )
|
||||||
|
{
|
||||||
|
// Since we're building a (list) value for indexing into
|
||||||
|
// a table, it is for sure an error to miss a value.
|
||||||
|
Warning(i, "Skipping input with missing non-optional value");
|
||||||
|
have_error = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( have_error )
|
if ( have_error )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue