Skip to content

Commit

Permalink
Detect zero-sized image (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
fintelia authored Dec 27, 2023
1 parent 088ab4f commit 84e5981
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ impl<R: Read + Seek> WebPDecoder<R> {

self.width = (w & 0x3FFF) as u32;
self.height = (h & 0x3FFF) as u32;
if self.width == 0 || self.height == 0 {
return Err(DecodingError::InconsistentImageSizes);
}

self.chunks
.insert(WebPRiffChunk::VP8, start..start + chunk_size as u64);
self.kind = ImageKind::Lossy;
Expand Down

0 comments on commit 84e5981

Please sign in to comment.