File ImageMagick-CVE-2014-9836.patch of Package ImageMagick.8212

--- a/coders/xpm.c
+++ b/coders/xpm.c
@@ -396,6 +396,8 @@ static Image *ReadXPMImage(const ImageInfo *image_info,ExceptionInfo *exception)
       {
         while ((isspace((int) ((unsigned char) *q)) == 0) && (*q != '\0'))
           q++;
+        if ((next-q) < 0)
+          break;
         if (next != (char *) NULL)
           (void) CopyXPMColor(target,q,MagickMin((size_t) (next-q),
             MaxTextExtent));