diff options
author | cc <cc@localhost> | 2025-08-20 19:07:21 -0700 |
---|---|---|
committer | cc <cc@localhost> | 2025-08-20 19:08:08 -0700 |
commit | 7da0f116c0b3bb50157d2aa028906eb923c57b2a (patch) | |
tree | d57fa97d211b794d8043367075c56e91859b268a /src | |
parent | 98f1bf9c4345eadcf2b15902f3a30d7c8483bb9e (diff) |
Boundary checking
Diffstat (limited to 'src')
-rw-r--r-- | src/tiff.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tiff.rs b/src/tiff.rs index f23e978..11755b6 100644 --- a/src/tiff.rs +++ b/src/tiff.rs @@ -178,11 +178,11 @@ pub fn as_standard_format(tiff_file_name: &str) -> Option<Vec<u32>> { let width_opt = get_image_width(tiff); let height_opt = get_image_height(tiff); let channels = get_image_channels(tiff); - if width_opt == None { + if (width_opt == None) || (height_opt == None) { return None; } - if height_opt == None { - return None; + if (channels == 0) || (channels > 4) { + return None } let width = width_opt.expect("Width Prechecked"); let height = height_opt.expect("Height Prechecked"); |