Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/decoders/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ macro_rules! fetch_ifd {
macro_rules! alloc_image_plain {
($width:expr, $height:expr, $dummy: expr) => (
{
if $width * $height > 500000000 || $width > 50000 || $height > 50000 {
panic!("rawloader: surely there's no such thing as a >500MP or >50000 px wide/tall image!");
let pixels = ($width as u64).checked_mul($height as u64).unwrap_or(u64::MAX);
if pixels > 500000000 || $width > 50000 || $height > 50000 {
panic!("rawloader: image dimensions exceed limits ({}x{})", $width, $height);
}
if $dummy {
vec![0]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub use decoders::cfa::CFA;
#[doc(hidden)] pub use decoders::RawLoader;

lazy_static! {
static ref LOADER: RawLoader = decoders::RawLoader::new();
static ref LOADER: RawLoader = RawLoader::new();
}

use std::path::Path;
Expand Down