Skip to content

Commit

Permalink
Truncate instead failing if string is too long in writer
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoltan Juhasz committed Oct 1, 2024
1 parent 42b7c90 commit 30d6ded
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions vendor/tracing/zero/writer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ end
let max_interned_string_length = 32000 - 1

let set_string_slot t ~string_id s =
let s =
if String.length s > max_interned_string_length
then String.sub s 0 max_interned_string_length
else s
in
let str_len = String.length s in
if str_len > max_interned_string_length
then failwithf "string too long for FTF trace: %i is over the limit of 32kb" str_len ();
(* String record *)
let rtype = 2 in
let rsize = 1 + round_words_for str_len in
Expand Down

0 comments on commit 30d6ded

Please sign in to comment.