mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
Merge remote-tracking branch 'origin/topic/bernhard/ticket1094'
* origin/topic/bernhard/ticket1094: Add minimal testcase for sqlite writer crash. Fixed Segmentation fault in SQLite Writer. BIT-1094 #merged BIT-1095 #comment Add to 2.2.1
This commit is contained in:
commit
1e31538829
4 changed files with 54 additions and 3 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit cfc8fe7ddf5ba3a9f957d1d5a98e9cfe1e9692ac
|
Subproject commit c16e91407595f9bf748b0b18e3b7566ccfaa5327
|
|
@ -308,7 +308,7 @@ int SQLite::AddParams(Value* val, int pos)
|
||||||
if ( j > 0 )
|
if ( j > 0 )
|
||||||
desc.AddRaw(set_separator);
|
desc.AddRaw(set_separator);
|
||||||
|
|
||||||
io->Describe(&desc, val->val.set_val.vals[j], fields[pos]->name);
|
io->Describe(&desc, val->val.set_val.vals[j], fields[pos-1]->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
desc.RemoveEscapeSequence(set_separator);
|
desc.RemoveEscapeSequence(set_separator);
|
||||||
|
@ -330,7 +330,7 @@ int SQLite::AddParams(Value* val, int pos)
|
||||||
if ( j > 0 )
|
if ( j > 0 )
|
||||||
desc.AddRaw(set_separator);
|
desc.AddRaw(set_separator);
|
||||||
|
|
||||||
io->Describe(&desc, val->val.vector_val.vals[j], fields[pos]->name);
|
io->Describe(&desc, val->val.vector_val.vals[j], fields[pos-1]->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
desc.RemoveEscapeSequence(set_separator);
|
desc.RemoveEscapeSequence(set_separator);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
CC,AA,BB
|
50
testing/btest/scripts/base/frameworks/logging/sqlite/set.bro
Normal file
50
testing/btest/scripts/base/frameworks/logging/sqlite/set.bro
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
#
|
||||||
|
# Check if set works in last position (the describe call in sqlite.cc has a good
|
||||||
|
# chance of being off by one if someone changes it).
|
||||||
|
#
|
||||||
|
# @TEST-REQUIRES: which sqlite3
|
||||||
|
# @TEST-REQUIRES: has-writer SQLite
|
||||||
|
# @TEST-GROUP: sqlite
|
||||||
|
#
|
||||||
|
# @TEST-EXEC: bro -b %INPUT
|
||||||
|
# @TEST-EXEC: sqlite3 ssh.sqlite 'select * from ssh' > ssh.select
|
||||||
|
# @TEST-EXEC: btest-diff ssh.select
|
||||||
|
#
|
||||||
|
# Testing all possible types.
|
||||||
|
|
||||||
|
redef LogSQLite::unset_field = "(unset)";
|
||||||
|
|
||||||
|
module SSH;
|
||||||
|
|
||||||
|
export {
|
||||||
|
redef enum Log::ID += { LOG };
|
||||||
|
|
||||||
|
type Log: record {
|
||||||
|
ss: set[string];
|
||||||
|
} &log;
|
||||||
|
}
|
||||||
|
|
||||||
|
function foo(i : count) : string
|
||||||
|
{
|
||||||
|
if ( i > 0 )
|
||||||
|
return "Foo";
|
||||||
|
else
|
||||||
|
return "Bar";
|
||||||
|
}
|
||||||
|
|
||||||
|
event bro_init()
|
||||||
|
{
|
||||||
|
Log::create_stream(SSH::LOG, [$columns=Log]);
|
||||||
|
Log::remove_filter(SSH::LOG, "default");
|
||||||
|
|
||||||
|
local filter: Log::Filter = [$name="sqlite", $path="ssh", $writer=Log::WRITER_SQLITE];
|
||||||
|
Log::add_filter(SSH::LOG, filter);
|
||||||
|
|
||||||
|
local empty_set: set[string];
|
||||||
|
local empty_vector: vector of string;
|
||||||
|
|
||||||
|
Log::write(SSH::LOG, [
|
||||||
|
$ss=set("AA", "BB", "CC")
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue