Merge remote-tracking branch 'origin/master' into topic/vladg/mysql

This commit is contained in:
Vlad Grigorescu 2014-10-31 21:32:19 -04:00
commit e86fc160db
14 changed files with 129 additions and 10 deletions

12
CHANGES
View file

@ -1,4 +1,16 @@
2.3-274 | 2014-10-31 17:45:25 -0700
* Adding call to new binpac::init() function. (Robin Sommer)
2.3-272 | 2014-10-31 16:29:42 -0700
* Fix segfault if when statement's RHS is unitialized. Addresses
BIT-1176. (Jon Siwek)
* Fix checking vector indices via "in". Addresses BIT-1280. (Jon
Siwek)
2.3-268 | 2014-10-31 12:12:22 -0500
* BIT-1283: Fix crash when using &encrypt. (Jon Siwek)

View file

@ -1 +1 @@
2.3-268
2.3-274

@ -1 +1 @@
Subproject commit c8e017b4b1893cf254fc2bc8eedd86b852a2e654
Subproject commit 7f440d060e0df675c1aab3357ff7b93fcf1c2cae

@ -1 +1 @@
Subproject commit 977654dc51ab08a2afde32241f108cdb4a581d8f
Subproject commit 95afe42e7474113a16cb2cb09ebdf8b552c59744

@ -1 +1 @@
Subproject commit acb8fbe8e7bc6ace5135fb73dca8e29432cdc1ca
Subproject commit 33d0ed4a54a6ecf08a0b5fe18831aa413b437066

@ -1 +1 @@
Subproject commit 39e865dec9611b9b53b609cbc8df519cebae0a1e
Subproject commit 2f808bc8541378b1a4953cca02c58c43945d154f

2
cmake

@ -1 +1 @@
Subproject commit 1316c07f7059647b6c4a496ea36e4b83bb5d8f0f
Subproject commit 03de0cc467d2334dcb851eddd843d59fef217909

View file

@ -636,7 +636,7 @@ Val* BinaryExpr::Eval(Frame* f) const
return v_result;
}
if ( is_vec1 || is_vec2 )
if ( IsVector(Type()->Tag()) && (is_vec1 || is_vec2) )
{ // fold vector against scalar
VectorVal* vv = (is_vec1 ? v1 : v2)->AsVectorVal();
VectorVal* v_result = new VectorVal(Type()->AsVectorType());
@ -4703,8 +4703,14 @@ Val* InExpr::Fold(Val* v1, Val* v2) const
v2->Type()->Tag() == TYPE_SUBNET )
return new Val(v2->AsSubNetVal()->Contains(v1->AsAddr()), TYPE_BOOL);
TableVal* vt = v2->AsTableVal();
if ( vt->Lookup(v1, false) )
Val* res;
if ( is_vector(v2) )
res = v2->AsVectorVal()->Lookup(v1);
else
res = v2->AsTableVal()->Lookup(v1, false);
if ( res )
return new Val(1, TYPE_BOOL);
else
return new Val(0, TYPE_BOOL);

View file

@ -207,7 +207,7 @@ bool Trigger::Eval()
return false;
}
if ( v->IsZero() )
if ( ! v || v->IsZero() )
{
// Not true. Perhaps next time...
DBG_LOG(DBG_NOTIFIERS, "%s: trigger condition is false", Name());

View file

@ -775,6 +775,9 @@ int main(int argc, char** argv)
// DEBUG_MSG("HMAC key: %s\n", md5_digest_print(shared_hmac_md5_key));
init_hash_function();
// Must come after hash initialization.
binpac::init();
ERR_load_crypto_strings();
OPENSSL_add_all_algorithms_conf();
SSL_library_init();

View file

@ -0,0 +1,11 @@
[zero, one, , , , five, , seven]
vec[0] = zero.exe
vec[1] = one.exe
vec[2] = <not set>
vec[3] = <not set>
vec[4] = <not set>
vec[5] = five.exe
vec[6] = <not set>
vec[7] = seven.exe
vec[8] = <not set>
vec[9] = <not set>

View file

@ -0,0 +1,38 @@
error in /Users/jsiwek/Projects/bro/bro/testing/btest/.tmp/language.when-unitialized-rhs/when-unitialized-rhs.bro, line 9: value used but not set (crashMe)
error in /Users/jsiwek/Projects/bro/bro/testing/btest/.tmp/language.when-unitialized-rhs/when-unitialized-rhs.bro, line 14: value used but not set (x)
1
2
3
4
5
6
7
8
9
10
2nd when stmt executing, 999
1st when stmt executing, not anymore you don't
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

View file

@ -0,0 +1,17 @@
# @TEST-EXEC: bro -b %INPUT >out
# @TEST-EXEC: btest-diff out
local ten = "0123456789";
local vec: vector of string = { "zero", "one" };
local n = 0;
vec[5] = "five";
vec[7] = "seven";
print vec;
vec = vec + ".exe";
for ( c in ten )
{
local is_set: bool = (n in vec);
print fmt("vec[%s] = %s", n, is_set ? vec[n] : "<not set>");
++n;
}

View file

@ -0,0 +1,32 @@
# @TEST-EXEC: bro -b -r $TRACES/wikipedia.trace %INPUT >out 2>&1
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
global crashMe: function(): string;
global x: int;
event bro_init()
{
when( local result = crashMe() )
{
print "1st when stmt executing", result;
}
when( local other_result = x )
{
print "2nd when stmt executing", other_result;
}
}
global conn_count = 0;
event new_connection(c: connection)
{
++conn_count;
print conn_count;
if ( conn_count == 10 )
{
x = 999;
crashMe = function(): string { return "not anymore you don't"; };
}
}