From 4693836b52ec11c0348f9687b8c1f92ce27f991f Mon Sep 17 00:00:00 2001 From: cristy Date: Sat, 10 Jan 2015 23:56:02 +0000 Subject: [PATCH] --- coders/wpg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/coders/wpg.c b/coders/wpg.c index cc292a30c..caec51537 100644 --- a/coders/wpg.c +++ b/coders/wpg.c @@ -470,8 +470,13 @@ static int UnpackWPGRaster(Image *image,int bpp,ExceptionInfo *exception) while(y<(ssize_t) image->rows) { - bbuf=ReadBlobByte(image); + int + c; + c=ReadBlobByte(image); + if (c == EOF) + break; + bbuf=(unsigned char) c; RunCount=bbuf & 0x7F; if(bbuf & 0x80) { @@ -517,7 +522,7 @@ static int UnpackWPGRaster(Image *image,int bpp,ExceptionInfo *exception) } } BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff); - return(0); + return(y <(ssize_t) image->rows ? -5 : 0); } -- 2.40.0