From dd7c16bc87fb509bcc1b543f518897b7efee7a44 Mon Sep 17 00:00:00 2001 From: Thiago <163585908+tchrono@users.noreply.github.com> Date: Tue, 9 Jul 2024 13:20:06 -0300 Subject: [PATCH] variant_utils: Set the variant size on strings/bytes Since https://github.com/fluent/fluent-bit/commit/1ce8d04598, any code that needs to read a variant string/bytes size must use the `cfl_variant_size_get` function because variant strings might be references. Ctraces must also set that field or else it is not possible to determine the length. Signed-off-by: Thiago <163585908+tchrono@users.noreply.github.com> --- include/ctraces/ctr_variant_utils.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/ctraces/ctr_variant_utils.h b/include/ctraces/ctr_variant_utils.h index d8f2516..029950c 100644 --- a/include/ctraces/ctr_variant_utils.h +++ b/include/ctraces/ctr_variant_utils.h @@ -420,6 +420,7 @@ static inline int unpack_cfl_variant_string(mpack_reader_t *reader, } (*value)->type = CFL_VARIANT_STRING; + (*value)->size = value_length; return 0; } @@ -465,6 +466,7 @@ static inline int unpack_cfl_variant_binary(mpack_reader_t *reader, } (*value)->type = CFL_VARIANT_BYTES; + (*value)->size = value_length; return 0; }