mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 19:24:25 +03:00
klocwork: fix risk issues
This commit is contained in:
committed by
Konstantinos Margaritis
parent
75dbedeebe
commit
978105a4c0
@@ -58,7 +58,10 @@ void readRow(sqlite3_stmt *statement, vector<DataBlock> &blocks,
|
||||
}
|
||||
auto internal_stream_index = stream_indices[stream_id];
|
||||
|
||||
assert(blob || bytes > 0);
|
||||
if (!(blob && bytes > 0)) {
|
||||
assert(0);
|
||||
throw std::domain_error("Invalid blob or bytes from sqlite3.");
|
||||
}
|
||||
blocks.emplace_back(id, stream_id, internal_stream_index,
|
||||
string(blob, blob + bytes));
|
||||
}
|
||||
|
@@ -740,6 +740,11 @@ u64a byte_size(const vector<DataBlock> &corpus_blocks) {
|
||||
total += block.payload.size();
|
||||
}
|
||||
|
||||
if (total == 0) {
|
||||
assert(0);
|
||||
throw std::invalid_argument("Empty corpus.");
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user