From a60ea2d6f49c91a763a0dbe331259f8deba2f460 Mon Sep 17 00:00:00 2001 From: Matthew Gregan Date: Wed, 28 Oct 2015 16:39:12 +1300 Subject: [PATCH] Convert assert in read_box_header to an error return. --- src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 7fada166..aba9d605 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -270,7 +270,9 @@ pub fn read_box_header(src: &mut T) -> Result { 0 => return Err(Error::InvalidData), 1 => { let size64 = try!(be_u64(src)); - assert!(size64 >= 16); + if size64 < 16 { + return Err(Error::InvalidData); + } size64 }, 2 ... 7 => return Err(Error::InvalidData),