Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash while passing an empty parameter through chain of scl blocks #244

Closed
furiel opened this issue Aug 8, 2024 · 2 comments · Fixed by #254
Closed

crash while passing an empty parameter through chain of scl blocks #244

furiel opened this issue Aug 8, 2024 · 2 comments · Fixed by #254
Labels
bug Something isn't working

Comments

@furiel
Copy link
Contributor

furiel commented Aug 8, 2024

Dear maintainers, I noticed there is some kind of crash when I want to pass an "" parameter through multiple embedded scl blocks. Could you take a look?

Reproduction

@version: current

block destination second(...) {
      `__VARARGS__`
};

block destination first(...) {
      second(`__VARARGS__`);
};

log {
   destination{ first(some-param("")) };
};

Backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7e4967b in _report_generator_args (key=0x5555556075b0, value=0x0, user_data=0x55555561dd40)
    at ../lib/cfg-block-generator.c:42
42	  for (const gchar *c = (const gchar *) value; *c; c++)
(gdb) bt
#0  0x00007ffff7e4967b in _report_generator_args (key=0x5555556075b0, value=0x0, user_data=0x55555561dd40)
    at ../lib/cfg-block-generator.c:42
#1  0x00007ffff74fb9bb in g_hash_table_foreach (hash_table=0x5555555b8420, 
    func=0x7ffff7e493f3 <_report_generator_args>, user_data=0x55555561dd40) at ../glib/glib/ghash.c:2117
#2  0x00007ffff7e484d3 in cfg_args_foreach (self=0x55555561dd80, func=0x7ffff7e493f3 <_report_generator_args>, 
    user_data=0x55555561dd40) at ../lib/cfg-args.c:53
#3  0x00007ffff7e497a8 in cfg_block_generator_generate (self=0x5555556099b0, cfg=0x555555584790, 
    args=0x55555561dd80, result=0x55555561dd40, reference=0x7fffffff99a0 "etc/syslog-ng.conf:8:7")
    at ../lib/cfg-block-generator.c:61
#4  0x00007ffff7e4c238 in cfg_lexer_parse_and_run_block_generator (self=0x55555560cb60, p=0x555555609a10, 
    yylval=0x7fffffff9d50) at ../lib/cfg-lexer.c:1083
#5  0x00007ffff7e4c4b5 in cfg_lexer_preprocess (self=0x55555560cb60, tok=10430, yylval=0x7fffffff9d50, 
    yylloc=0x7fffffff9d90) at ../lib/cfg-lexer.c:1151
#6  0x00007ffff7e4c693 in cfg_lexer_lex (self=0x55555560cb60, yylval=0x7fffffff9d50, yylloc=0x7fffffff9d90)
    at ../lib/cfg-lexer.c:1224
#7  0x00007ffff7e4e289 in main_lex (yylval=0x7fffffff9d50, yylloc=0x7fffffff9d90, lexer=0x55555560cb60)
    at ../lib/cfg-parser.c:233
#8  0x00007ffff7ea508f in main_parse (lexer=0x55555560cb60, dummy=0x7fffffffdaf8, arg=0x0) at lib/cfg-grammar.c:3867
#9  0x00007ffff7e4e521 in cfg_parser_parse (self=0x7ffff7fb6060 <main_parser>, lexer=0x55555560cb60, 
    instance=0x7fffffffdaf8, arg=0x0) at ../lib/cfg-parser.c:299
#10 0x00007ffff7e47a19 in cfg_run_parser (self=0x555555584790, lexer=0x55555560cb60, 
    parser=0x7ffff7fb6060 <main_parser>, result=0x7fffffffdaf8, arg=0x0) at ../lib/cfg.c:534
#11 0x00007ffff7e48039 in cfg_read_config (self=0x555555584790, fname=0x555555563320 "etc/syslog-ng.conf", 
    preprocess_into=0x0) at ../lib/cfg.c:655
#12 0x00007ffff7e71e43 in main_loop_read_and_init_config (self=0x7ffff7fba3c0 <main_loop>) at ../lib/mainloop.c:680
#13 0x0000555555556ac7 in main (argc=1, argv=0x7fffffffdcd8) at ../syslog-ng/main.c:319
@OverOrion
Copy link
Contributor

Thank you for your report @furiel! I opened a PR with the potential fix.

@MrAnno
Copy link
Member

MrAnno commented Oct 16, 2024

Follow-up issue: #341

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants