Skip to content

Commit dd7c16b

Browse files
tchronoedsiper
authored andcommittedJul 9, 2024
variant_utils: Set the variant size on strings/bytes
Since fluent/fluent-bit@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>
1 parent aed224e commit dd7c16b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎include/ctraces/ctr_variant_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ static inline int unpack_cfl_variant_string(mpack_reader_t *reader,
420420
}
421421

422422
(*value)->type = CFL_VARIANT_STRING;
423+
(*value)->size = value_length;
423424

424425
return 0;
425426
}
@@ -465,6 +466,7 @@ static inline int unpack_cfl_variant_binary(mpack_reader_t *reader,
465466
}
466467

467468
(*value)->type = CFL_VARIANT_BYTES;
469+
(*value)->size = value_length;
468470

469471
return 0;
470472
}

0 commit comments

Comments
 (0)