mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Merge remote-tracking branch 'origin/topic/timw/coverity-fixes'
* origin/topic/timw/coverity-fixes: Avoid a null dereference (Coverity-1402816) Avoid resource leaks (Coverity-1402818, Coverity-1402812) Avoid null dereference in broker (Coverity-1402824, Coverity-1402814) Remove unused variable from RecordVal (Coverity-1402820)
This commit is contained in:
commit
0d34a1c646
7 changed files with 23 additions and 5 deletions
10
CHANGES
10
CHANGES
|
@ -1,4 +1,14 @@
|
||||||
|
|
||||||
|
2.6-575 | 2019-07-09 18:28:03 -0700
|
||||||
|
|
||||||
|
* Avoid a null dereference (Coverity-1402816) (Tim Wojtulewicz, Corelight)
|
||||||
|
|
||||||
|
* Avoid resource leaks (Coverity-1402818, Coverity-1402812) (Tim Wojtulewicz, Corelight)
|
||||||
|
|
||||||
|
* Avoid null dereference in broker (Coverity-1402824, Coverity-1402814) (Tim Wojtulewicz, Corelight)
|
||||||
|
|
||||||
|
* Improve stability of a unit test (Jon Siwek, Corelight)
|
||||||
|
|
||||||
2.6-569 | 2019-07-03 13:03:22 -0700
|
2.6-569 | 2019-07-03 13:03:22 -0700
|
||||||
|
|
||||||
* Improve stability of a unit test (Jon Siwek, Corelight)
|
* Improve stability of a unit test (Jon Siwek, Corelight)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.6-569
|
2.6-575
|
||||||
|
|
|
@ -2020,7 +2020,7 @@ vector<RecordVal*> RecordVal::parse_time_records;
|
||||||
|
|
||||||
RecordVal::RecordVal(RecordType* t, bool init_fields) : Val(t)
|
RecordVal::RecordVal(RecordType* t, bool init_fields) : Val(t)
|
||||||
{
|
{
|
||||||
origin = 0;
|
origin = nullptr;
|
||||||
int n = t->NumFields();
|
int n = t->NumFields();
|
||||||
val_list* vl = val.val_list_val = new val_list(n);
|
val_list* vl = val.val_list_val = new val_list(n);
|
||||||
|
|
||||||
|
|
|
@ -981,7 +981,6 @@ protected:
|
||||||
|
|
||||||
Val* DoClone(CloneState* state) override;
|
Val* DoClone(CloneState* state) override;
|
||||||
|
|
||||||
RecordType* record_type;
|
|
||||||
BroObj* origin;
|
BroObj* origin;
|
||||||
|
|
||||||
static vector<RecordVal*> parse_time_records;
|
static vector<RecordVal*> parse_time_records;
|
||||||
|
|
|
@ -1200,6 +1200,9 @@ bool bro_broker::VectorIterator::DoUnserialize(const broker::data& data)
|
||||||
auto x = caf::get_if<broker::vector>(&(*v)[0]);
|
auto x = caf::get_if<broker::vector>(&(*v)[0]);
|
||||||
auto y = caf::get_if<broker::integer>(&(*v)[1]);
|
auto y = caf::get_if<broker::integer>(&(*v)[1]);
|
||||||
|
|
||||||
|
if ( ! (x && y) )
|
||||||
|
return false;
|
||||||
|
|
||||||
dat = *x;
|
dat = *x;
|
||||||
it = dat.begin() + *y;
|
it = dat.begin() + *y;
|
||||||
return true;
|
return true;
|
||||||
|
@ -1222,6 +1225,9 @@ bool bro_broker::RecordIterator::DoUnserialize(const broker::data& data)
|
||||||
auto x = caf::get_if<broker::vector>(&(*v)[0]);
|
auto x = caf::get_if<broker::vector>(&(*v)[0]);
|
||||||
auto y = caf::get_if<broker::integer>(&(*v)[1]);
|
auto y = caf::get_if<broker::integer>(&(*v)[1]);
|
||||||
|
|
||||||
|
if ( ! (x && y) )
|
||||||
|
return false;
|
||||||
|
|
||||||
dat = *x;
|
dat = *x;
|
||||||
it = dat.begin() + *y;
|
it = dat.begin() + *y;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -179,6 +179,9 @@ std::unique_ptr<CounterVector> CounterVector::Unserialize(const broker::data& da
|
||||||
auto width = caf::get_if<uint64>(&(*v)[0]);
|
auto width = caf::get_if<uint64>(&(*v)[0]);
|
||||||
auto bits = BitVector::Unserialize((*v)[1]);
|
auto bits = BitVector::Unserialize((*v)[1]);
|
||||||
|
|
||||||
|
if ( ! (width && bits) )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
auto cv = std::unique_ptr<CounterVector>(new CounterVector());
|
auto cv = std::unique_ptr<CounterVector>(new CounterVector());
|
||||||
cv->width = *width;
|
cv->width = *width;
|
||||||
cv->bits = bits.release();
|
cv->bits = bits.release();
|
||||||
|
|
|
@ -492,25 +492,25 @@ bool TopkVal::DoUnserialize(const broker::data& data)
|
||||||
|
|
||||||
while ( i < numElements )
|
while ( i < numElements )
|
||||||
{
|
{
|
||||||
Bucket* b = new Bucket();
|
|
||||||
auto elements_count = caf::get_if<uint64>(&(*v)[idx++]);
|
auto elements_count = caf::get_if<uint64>(&(*v)[idx++]);
|
||||||
auto count = caf::get_if<uint64>(&(*v)[idx++]);
|
auto count = caf::get_if<uint64>(&(*v)[idx++]);
|
||||||
|
|
||||||
if ( ! (elements_count && count) )
|
if ( ! (elements_count && count) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Bucket* b = new Bucket();
|
||||||
b->count = *count;
|
b->count = *count;
|
||||||
b->bucketPos = buckets.insert(buckets.end(), b);
|
b->bucketPos = buckets.insert(buckets.end(), b);
|
||||||
|
|
||||||
for ( uint64_t j = 0; j < *elements_count; j++ )
|
for ( uint64_t j = 0; j < *elements_count; j++ )
|
||||||
{
|
{
|
||||||
Element* e = new Element();
|
|
||||||
auto epsilon = caf::get_if<uint64>(&(*v)[idx++]);
|
auto epsilon = caf::get_if<uint64>(&(*v)[idx++]);
|
||||||
Val* val = bro_broker::data_to_val((*v)[idx++], type);
|
Val* val = bro_broker::data_to_val((*v)[idx++], type);
|
||||||
|
|
||||||
if ( ! (epsilon && val) )
|
if ( ! (epsilon && val) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Element* e = new Element();
|
||||||
e->epsilon = *epsilon;
|
e->epsilon = *epsilon;
|
||||||
e->value = val;
|
e->value = val;
|
||||||
e->parent = b;
|
e->parent = b;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue