Skip to content

Commit da7aff0

Browse files
Fujimoto Seijiedsiper
Fujimoto Seiji
authored andcommitted
parser: initialize decoders with NULL to avoid SIGSEGV
When Fluent Bit encounters with a partial parser definition, it crashes badly with a segmentation fault. $ ./bin/fluent-bit -R parser.conf -c tail.conf ... [2020/01/15 16:11:21] [error] [parser] no parser 'format' found for 'simple' in file 'conf/timestamp.parser' [engine] caught signal (SIGSEGV) #0 0x558bc4a0a226 in flb_parser_decoder_list_destroy() at src/flb_parser_decoder.c:700 #1 0x558bc4a05d75 in flb_parser_conf_file() at src/flb_parser.c:566 #2 0x558bc49f4bdd in flb_config_set_property() at src/flb_config.c:406 #3 0x558bc49e24ae in flb_service_conf() at src/fluent-bit.c:446 #4 0x558bc49e2f90 in main() at src/fluent-bit.c:807 #5 0x7fa1cb7f109a in ???() at ???:0 #6 0x558bc49e13a9 in ???() at ???:0 #7 0xffffffffffffffff in ???() at ???:0 Aborted This is just because `decoders` is not being initialized properly, and that confuses Fluent Bit to deallocate a random memmory block on the cleanup path. Fix it. Signed-off-by: Fujimoto Seiji <fujimoto@clear-code.com>
1 parent 901e43f commit da7aff0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/flb_parser.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ int flb_parser_conf_file(const char *file, struct flb_config *config)
412412
struct mk_list *head;
413413
struct stat st;
414414
struct flb_parser_types *types = NULL;
415-
struct mk_list *decoders;
415+
struct mk_list *decoders = NULL;
416416

417417
#ifndef FLB_HAVE_STATIC_CONF
418418
ret = stat(file, &st);

0 commit comments

Comments
 (0)