Re: Segmentation fault on 2.0.5
On 13.08.2019 17:45, Maria Jan Matejka wrote: define myvar = false; function something () { if myvar then { return false; } return true; } protocol device DEVICE { } Could this be because of the new filter code or something else? Hello Thanks for bugreport. Yes, it is the new filter code, most likely it is a bug in handling of statically eliminable (constant-false) if statements without else branch. Similar issue also happens for empty blocks: if true then { } What about the attached patch? Maria Hi, I can confirm that the patch works for my setup. Thank you, Radu
Re: Segmentation fault on 2.0.5
>> define myvar = false; >> >> function something () { >> if myvar then { >> return false; >> } >> >> return true; >> } >> >> protocol device DEVICE { >> >> } >> >> Could this be because of the new filter code or something else? > > Hello > > Thanks for bugreport. Yes, it is the new filter code, most likely > it is a bug in handling of statically eliminable (constant-false) > if statements without else branch. > > Similar issue also happens for empty blocks: > > if true then { } > What about the attached patch? Maria diff --git a/filter/config.Y b/filter/config.Y index a67a72a8..340053ba 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -446,7 +446,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN, %nonassoc THEN %nonassoc ELSE -%type cmds_int +%type cmds_int cmd_prep %type term block cmd cmds constant constructor print_list var_list function_call symbol_value bgp_path_expr bgp_path bgp_path_tail %type dynamic_attr %type static_attr @@ -624,17 +624,25 @@ cmds: /* EMPTY */ { $$ = NULL; } | cmds_int { $$ = $1.begin; } ; -cmds_int: cmd { +cmd_prep: cmd { $$.begin = $$.end = $1; - while ($$.end->next) -$$.end = $$.end->next; + if ($1) +while ($$.end->next) + $$.end = $$.end->next; +} + ; + +cmds_int: cmd_prep + | cmds_int cmd_prep { + if (!$1.begin) +$$ = $2; + else if (!$2.begin) +$$ = $1; + else { +$$.begin = $1.begin; +$$.end = $2.end; +$1.end->next = $2.begin; } - | cmds_int cmd { - $$.begin = $1.begin; - $1.end->next = $2; - $$.end = $2; - while ($$.end->next) -$$.end = $$.end->next; } ; diff --git a/filter/test.conf b/filter/test.conf index 09a4a88a..b1342819 100644 --- a/filter/test.conf +++ b/filter/test.conf @@ -1178,6 +1178,10 @@ bt_test_suite(t_include, "Testing including another config file"); function t_if_else() int i; { + /* Empty blocks regression test */ + if true then {} + else {} + if true then bt_assert(true); @@ -1187,6 +1191,10 @@ int i; bt_assert(true); else bt_assert(false); + + /* Empty blocks regression test */ + if true then {} + else {} } bt_test_suite(t_if_else, "Testing if-else statement"); smime.p7s Description: S/MIME Cryptographic Signature
Re: Segmentation fault on 2.0.5
On Sat, Aug 10, 2019 at 02:22:18PM +0300, Radu Anghel wrote: > Hello, > > I recently upgraded BIRD from 2.0.4 to 2.0.5 and with the same (pretty > large) .conf I got Segmentation fault. > > Until today I didn't have time to debug it, but here it goes: > > With this simple .conf I get seg fault on 2.0.5 while 2.0.4 works as > expected. (if I define myvar = true it doesn't crash on 2.0.5) > > log syslog all; > > define myvar = false; > > function something () { > if myvar then { > return false; > } > > return true; > } > > protocol device DEVICE { > > } > > Could this be because of the new filter code or something else? Hello Thanks for bugreport. Yes, it is the new filter code, most likely it is a bug in handling of statically eliminable (constant-false) if statements without else branch. Similar issue also happens for empty blocks: if true then { } -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santi...@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
Segmentation fault on 2.0.5
Hello, I recently upgraded BIRD from 2.0.4 to 2.0.5 and with the same (pretty large) .conf I got Segmentation fault. Until today I didn't have time to debug it, but here it goes: With this simple .conf I get seg fault on 2.0.5 while 2.0.4 works as expected. (if I define myvar = true it doesn't crash on 2.0.5) log syslog all; define myvar = false; function something () { if myvar then { return false; } return true; } protocol device DEVICE { } Could this be because of the new filter code or something else? Radu