Skip to content

Commit

Permalink
fix: check bounds of original image height
Browse files Browse the repository at this point in the history
  • Loading branch information
eWert-Online committed Sep 28, 2024
1 parent 5049f05 commit ca9e250
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/OSnap_Diff/OSnap_Diff.ml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ let diff
in
if not (Int32.equal diff_pixel 0x00000000l)
then diff_pixel
else (
else if row < original_image.height
then (
let pixel =
Array1.get
original_image.image
Expand All @@ -105,7 +106,8 @@ let diff
let b = (mono land 0xFF) lsl 16 in
let g = (mono land 0xFF) lsl 8 in
let r = (mono land 0xFF) lsl 0 in
Int32.of_int (a lor b lor g lor r)))
Int32.of_int (a lor b lor g lor r))
else 0x00000000l)
else if col > new_image_start && col <= new_image_end && row < new_image.height
then Array1.get new_image.image ((row * new_image.width) + (col - new_image_start))
else 0x00000000l
Expand Down

0 comments on commit ca9e250

Please sign in to comment.