Blame SOURCES/djvulibre-3.5.27-check-image-size.patch

a9380a
diff --git a/libdjvu/IW44Image.cpp b/libdjvu/IW44Image.cpp
a9380a
index e8d4b44..aa3d554 100644
a9380a
--- a/libdjvu/IW44Image.cpp
a9380a
+++ b/libdjvu/IW44Image.cpp
a9380a
@@ -678,7 +678,11 @@ IW44Image::Map::image(signed char *img8, int rowsize, int pixsep, int fast)
a9380a
   size_t sz = bw * bh;
a9380a
   if (sz / (size_t)bw != (size_t)bh) // multiplication overflow
a9380a
     G_THROW("IW44Image: image size exceeds maximum (corrupted file?)");
a9380a
+  if (sz == 0)
a9380a
+    G_THROW("IW44Image: zero size image (corrupted file?)");
a9380a
   GPBuffer<short> gdata16(data16,sz);
a9380a
+  if (data16 == NULL)
a9380a
+    G_THROW("IW44Image: unable to allocate image data");
a9380a
   // Copy coefficients
a9380a
   int i;
a9380a
   short *p = data16;