Skip to content

Commit

Permalink
Add crowbar as a dependency for tests and run the ocamlformat linter
Browse files Browse the repository at this point in the history
  • Loading branch information
robur-team committed Mar 11, 2024
1 parent 0b17ced commit 42e5282
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions digestif.opam
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ depends: [
"fpath" {with-test}
"rresult" {with-test}
"ocamlfind" {with-test}
"crowbar" {with-test}
]

conflicts: [
Expand Down
15 changes: 15 additions & 0 deletions fuzz/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(rule
(copy# fuzz.ml fuzz_c.ml))

(rule
(copy# fuzz.ml fuzz_ocaml.ml))

(executable
(name fuzz_c)
(modules fuzz_c)
(libraries digestif.c crowbar))

(executable
(name fuzz_ocaml)
(modules fuzz_ocaml)
(libraries digestif.ocaml crowbar))
3 changes: 2 additions & 1 deletion src-ocaml/digestif.ml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ module Unsafe (Hash : Hash) (D : Desc) = struct
let unsafe_get = unsafe_get

let get_into_bytes ctx ?(off = 0) buf =
if off < 0 || off >= Bytes.length buf then invalid_arg "offset out of bounds" ;
if off < 0 || off >= Bytes.length buf
then invalid_arg "offset out of bounds" ;
if Bytes.length buf - off < digest_size
then invalid_arg "destination too small" ;
let raw = unsafe_get (Hash.dup ctx) in
Expand Down

0 comments on commit 42e5282

Please sign in to comment.