From 9bdd4e3e98bbc2ecd8d7ebe766873240a9433c9b Mon Sep 17 00:00:00 2001 From: ryanohnemus Date: Thu, 9 Jan 2025 13:32:53 -0600 Subject: [PATCH] multiline: cri don't create msgpack buffer until validating time Signed-off-by: ryanohnemus --- src/flb_parser_cri.c | 12 ++++++------ src/multiline/flb_ml_parser_cri.c | 7 ++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/flb_parser_cri.c b/src/flb_parser_cri.c index dd791a1d927..71cbd9ee93b 100644 --- a/src/flb_parser_cri.c +++ b/src/flb_parser_cri.c @@ -68,13 +68,8 @@ int flb_parser_cri_do(struct flb_parser *parser, return -1; } - /* Prepare new outgoing buffer, then add time to it */ - msgpack_sbuffer_init(&tmp_sbuf); - msgpack_packer_init(&tmp_pck, &tmp_sbuf, msgpack_sbuffer_write); - msgpack_pack_map(&tmp_pck, map_size); - struct flb_tm tm = {0}; - ret = flb_parser_time_lookup(in_buf, token_end-in_buf-1, + ret = flb_parser_time_lookup(in_buf, token_end-in_buf, 0, parser, &tm, &tmfrac); if (ret == -1) { flb_error("[parser:%s] Invalid time format %s", @@ -82,6 +77,11 @@ int flb_parser_cri_do(struct flb_parser *parser, return -1; } + /* Prepare new outgoing buffer, then add time to it */ + msgpack_sbuffer_init(&tmp_sbuf); + msgpack_packer_init(&tmp_pck, &tmp_sbuf, msgpack_sbuffer_write); + msgpack_pack_map(&tmp_pck, map_size); + msgpack_pack_str(&tmp_pck, time_key_len); msgpack_pack_str_body(&tmp_pck, time_key, time_key_len); msgpack_pack_str(&tmp_pck, token_end-in_buf); diff --git a/src/multiline/flb_ml_parser_cri.c b/src/multiline/flb_ml_parser_cri.c index 4e20d966903..60fd73ac27c 100644 --- a/src/multiline/flb_ml_parser_cri.c +++ b/src/multiline/flb_ml_parser_cri.c @@ -21,9 +21,6 @@ #include #include -//Reverting change for fuzz test... -#define FLB_ML_CRI_REGEX \ - "^(?