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:
Robin Sommer 2013-11-11 13:42:52 -08:00
commit 1e31538829
4 changed files with 54 additions and 3 deletions

View 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")
]);
}