File ImageMagick-CVE-2017-11478.patch of Package ImageMagick.8212

diff --git a/coders/djvu.c b/coders/djvu.c
index c74579937f..570e25ca57 100644
--- a/coders/djvu.c
+++ b/coders/djvu.c
@@ -613,6 +613,7 @@ static Image *ReadOneDJVUImage(LoadContext* lc,const int pagenum,
                                 if (tag == 0) break;
                                 ddjvu_message_pop(lc->context);
                         } while ((message = ddjvu_message_peek(lc->context)));
+                if (tag == 0) break;
         } while (!ddjvu_page_decoding_done(lc->page));
 
         ddjvu_document_get_pageinfo(lc->document, pagenum, &info);
@@ -887,7 +888,8 @@ static Image *ReadDJVUImage(const ImageInfo *image_info,
         break;
   }
   djvu_close_lc(lc);
-  (void) CloseBlob(images);
+  if (images != (Image *) NULL)
+    (void) CloseBlob(images);
   if (image != (Image *) NULL)
     image=DestroyImageList(image);