From 3199a562f88fc7a2f458f52a5544a389ad310942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Sat, 28 Jul 2018 22:18:30 +0300 Subject: [PATCH] chamge pixel limit from u32 to u64 --- flif/src/components/header.rs | 8 ++++---- flif/src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flif/src/components/header.rs b/flif/src/components/header.rs index 4202990..fc5a754 100644 --- a/flif/src/components/header.rs +++ b/flif/src/components/header.rs @@ -37,10 +37,10 @@ fn read_varint(reader: &mut R, delta: u32) -> Result { } /// Check if number of pixels uphelds provided limit -fn check_limit(width: u32, height: u32, frames: u32, limit: u32) -> Result<()> { - let pixels = frames - .checked_mul(width) - .and_then(|val| val.checked_mul(height)); +fn check_limit(width: u32, height: u32, frames: u32, limit: u64) -> Result<()> { + let pixels = (frames as u64) + .checked_mul(width as u64) + .and_then(|val| val.checked_mul(height as u64)); match pixels { Some(pix) if pix > limit => Err(Error::LimitViolation(format!( "number of pixels exceeds limit: {}/{}", diff --git a/flif/src/lib.rs b/flif/src/lib.rs index a6cee4d..54d1672 100644 --- a/flif/src/lib.rs +++ b/flif/src/lib.rs @@ -84,7 +84,7 @@ pub struct Limits { /// max number of metadata entries (default: 8) pub metadata_count: u32, /// max number of pixels: `width * height * frames` (default: 67M = 226) - pub pixels: u32, + pub pixels: u64, /// max number of MANIAC nodes (default: 16384 = 214) pub maniac_nodes: u32, }