Skip to content

Commit

Permalink
variant_utils: Set the variant size on strings/bytes
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tchrono authored and edsiper committed Jul 9, 2024
1 parent aed224e commit dd7c16b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/ctraces/ctr_variant_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit dd7c16b

Please sign in to comment.