Segfault on eval of case expression

Ondrej Zajicek santiago at crfreenet.org
Sat Jan 7 05:12:10 CET 2023


On Fri, Jan 06, 2023 at 03:51:04PM +0000, Jiten Kumar Pathy via Bird-users wrote:
> Hello,
> 
> The following filter causes bird2 to segfault:
> ````
> filter test {
>   case 2 {
>       1: accept;
>       else: reject;
>   }
> }

Hello

Thanks for the bugreport, it seems like during parsing of a constant
switch expression already linearized code (in struct f_line) for a branch
got confused as parsed instruction code (in struct f_inst).


> I have locally added `NEVER_CONSTANT` to `FI_SWITCH` instruction as a
> temporary workaround.

That is a good workaround, We also have NEVER_CONSTANT for function
calls (which would have similar problem), so we could likely add it for
switches.

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at 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."


More information about the Bird-users mailing list