Merge remote-tracking branch 'origin/topic/timw/coverity-findings'

* origin/topic/timw/coverity-findings:
  Fix a number of Coverity findings
This commit is contained in:
Tim Wojtulewicz 2021-07-06 08:49:50 -07:00
commit 2021df7418
7 changed files with 19 additions and 7 deletions

10
CHANGES
View file

@ -1,3 +1,13 @@
4.1.0-dev.891 | 2021-07-06 08:49:50 -0700
* Fix a number of Coverity findings (Tim Wojtulewicz, Corelight)
- 1458048: Use-after-free in the SQLite logger
- 1457823: Missing a break statement in script-opt reduction
- 1453966: Dead code in CompHash
- 1445417: Unintialized variable in StaticHash64
- 1437716: Unintialized variables in FileInfo in scan.l
4.1.0-dev.889 | 2021-07-06 08:48:50 -0700
* Add a few DNS query types. (Johanna Amann, Corelight)

View file

@ -1 +1 @@
4.1.0-dev.889
4.1.0-dev.891

View file

@ -512,7 +512,7 @@ int CompositeHash::SingleTypeKeySize(Type* bt, const Val* v,
if ( ! v )
return (optional && ! calc_static_size) ? sz : 0;
const RecordVal* rv = v ? v->AsRecordVal() : nullptr;
const RecordVal* rv = v->AsRecordVal();
RecordType* rt = bt->AsRecordType();
int num_fields = rt->NumFields();

View file

@ -67,7 +67,7 @@ void KeyedHash::Hash256(const void* bytes, uint64_t size, hash256_t* result)
hash64_t KeyedHash::StaticHash64(const void* bytes, uint64_t size)
{
hash64_t result;
hash64_t result = 0;
highwayhash::InstructionSets::Run<highwayhash::HighwayHash>(cluster_highwayhash_key, reinterpret_cast<const char *>(bytes), size, &result);
return result;
}

View file

@ -169,15 +169,16 @@ bool SQLite::DoInit(const WriterInfo& info, int arg_num_fields,
}
create += fieldname;
sqlite3_free(fieldname);
string type = GetTableType(field->type, field->subtype);
if ( type == "" )
{
InternalError(Fmt("Could not determine type for field %u:%s", i, fieldname));
sqlite3_free(fieldname);
return false;
}
sqlite3_free(fieldname);
create += " " + type;
/* if ( !field->optional ) {

View file

@ -106,9 +106,9 @@ public:
YY_BUFFER_STATE buffer_state;
std::string restore_module;
const char* name;
int line;
int level;
const char* name = nullptr;
int line = 0;
int level = 0;
};
// A stack of input buffers we're scanning. file_stack[len-1] is the

View file

@ -959,6 +959,7 @@ TraversalCode CSE_ValidityChecker::PreExpr(const Expr* e)
return TC_ABORTALL;
}
}
break;
case EXPR_APPEND_TO:
// This doesn't directly change any identifiers, but does