File ImageMagick-6.2.5-CVE-2007-4988.patch of Package ImageMagick

--- ImageMagick-6.3.0/coders/dib.c
+++ ImageMagick-6.3.0/coders/dib.c
@@ -444,6 +444,14 @@
 %
 %
 */
+
+static inline long MagickAbsoluteValue(const long x)
+{
+  if (x < 0)
+    return(-x);
+  return(x);
+}
+
 static Image *ReadDIBImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
   DIBInfo
@@ -534,7 +542,7 @@
       dib_info.blue_mask=ReadBlobLSBLong(image);
     }
   image->matte=dib_info.bits_per_pixel == 32 ? MagickTrue : MagickFalse;
-  image->columns=dib_info.width;
+  image->columns=(unsigned long) MagickAbsoluteValue(dib_info.width);
   image->rows=AbsoluteValue(dib_info.height);
   image->depth=8;
   if ((dib_info.number_colors != 0) || (dib_info.bits_per_pixel < 16))
openSUSE Build Service is sponsored by