From ad2edd45a4397c75a2e1810799bd34723aec8a66 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sun, 11 Feb 2018 13:59:23 -0500 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/967 --- MagickCore/accelerate.c | 2 +- coders/pwp.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/MagickCore/accelerate.c b/MagickCore/accelerate.c index 6bcb5a84f..f20826b25 100644 --- a/MagickCore/accelerate.c +++ b/MagickCore/accelerate.c @@ -4325,7 +4325,7 @@ static Image *ComputeResizeImage(const Image* image,MagickCLEnv clEnv, for (i = 0; i < 7; i++) coefficientBuffer[i]=(float) resizeFilterCoefficient[i]; cubicCoefficientsBuffer=CreateOpenCLBuffer(device,CL_MEM_COPY_HOST_PTR | - CL_MEM_READ_ONLY,7*sizeof(*resizeFilterCoefficient),&coefficientBuffer); + CL_MEM_READ_ONLY,7*sizeof(*cubicCoefficientsBuffer),&coefficientBuffer); if (cubicCoefficientsBuffer == (cl_mem) NULL) { (void) OpenCLThrowMagickException(device,exception,GetMagickModule(), diff --git a/coders/pwp.c b/coders/pwp.c index ac3693f53..89e7a2194 100644 --- a/coders/pwp.c +++ b/coders/pwp.c @@ -121,6 +121,9 @@ static MagickBooleanType IsPWP(const unsigned char *magick,const size_t length) */ static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception) { + char + filename[MagickPathExtent]; + FILE *file; @@ -178,7 +181,9 @@ static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception) (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL, (void *) NULL); SetImageInfoBlob(read_info,(void *) NULL,0); - unique_file=AcquireUniqueFileResource(read_info->filename); + unique_file=AcquireUniqueFileResource(filename); + (void) FormatLocaleString(read_info->filename,MagickPathExtent,"sfw:%s", + filename); for ( ; ; ) { (void) memset(magick,0,sizeof(magick)); @@ -192,13 +197,13 @@ static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception) } if (c == EOF) { - (void) RelinquishUniqueFileResource(read_info->filename); + (void) RelinquishUniqueFileResource(filename); read_info=DestroyImageInfo(read_info); ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); } if (LocaleNCompare((char *) (magick+12),"SFW94A",6) != 0) { - (void) RelinquishUniqueFileResource(read_info->filename); + (void) RelinquishUniqueFileResource(filename); read_info=DestroyImageInfo(read_info); ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } @@ -210,7 +215,7 @@ static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception) file=fdopen(unique_file,"wb"); if ((unique_file == -1) || (file == (FILE *) NULL)) { - (void) RelinquishUniqueFileResource(read_info->filename); + (void) RelinquishUniqueFileResource(filename); read_info=DestroyImageInfo(read_info); ThrowFileException(exception,FileOpenError,"UnableToWriteFile", image->filename); @@ -230,7 +235,7 @@ static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception) (void) fclose(file); if (c == EOF) { - (void) RelinquishUniqueFileResource(read_info->filename); + (void) RelinquishUniqueFileResource(filename); read_info=DestroyImageInfo(read_info); ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); } @@ -261,7 +266,7 @@ static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception) } if (unique_file != -1) (void) close(unique_file); - (void) RelinquishUniqueFileResource(read_info->filename); + (void) RelinquishUniqueFileResource(filename); read_info=DestroyImageInfo(read_info); if (image != (Image *) NULL) { -- 2.40.0