Skip to content

Commit d3aeab3

Browse files
author
Zoltan Juhasz
committed
Truncate instead failing if string is too long in writer
Signed-off-by: Zoltan Juhasz <zoltan.juhasz@radix-trading.com>
1 parent 42b7c90 commit d3aeab3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

vendor/tracing/zero/writer.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,12 @@ end
153153
let max_interned_string_length = 32000 - 1
154154

155155
let set_string_slot t ~string_id s =
156+
let s =
157+
if String.length s > max_interned_string_length
158+
then String.sub s 0 max_interned_string_length
159+
else s
160+
in
156161
let str_len = String.length s in
157-
if str_len > max_interned_string_length
158-
then failwithf "string too long for FTF trace: %i is over the limit of 32kb" str_len ();
159162
(* String record *)
160163
let rtype = 2 in
161164
let rsize = 1 + round_words_for str_len in

0 commit comments

Comments
 (0)