Skip to content

Commit 8151ddf

Browse files
balatmistral-vibe
andcommitted
Add validation for inline_contents_max_bytes configuration
Validate that inline_contents_max_bytes is non-negative to prevent invalid configurations that could lead to unexpected behavior. The validation is performed during configuration initialization and raises an Invalid_argument exception with a clear error message if the value is negative. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
1 parent 85f83dc commit 8151ddf

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/irmin-pack/conf.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ let init ~sw ~fs ?(fresh = Default.fresh) ?(readonly = Default.readonly)
193193
let config = add config Key.use_fsync use_fsync in
194194
let config = add config Key.no_migrate no_migrate in
195195
let config = add config Key.inline_contents inline_contents in
196+
if inline_contents_max_bytes < 0 then
197+
invalid_arg
198+
(Printf.sprintf
199+
"Irmin_pack.Conf: inline_contents_max_bytes must be non-negative \
200+
(got %d)"
201+
inline_contents_max_bytes);
196202
let config =
197203
add config Key.inline_contents_max_bytes inline_contents_max_bytes
198204
in

0 commit comments

Comments
 (0)