File ImageMagick-CVE-2017-12983.patch of Package ImageMagick.29977
--- a/coders/sfw.c
+++ b/coders/sfw.c
@@ -253,8 +253,8 @@ static Image *ReadSFWImage(const ImageInfo *image_info,ExceptionInfo *exception)
*/
if (GetBlobSize(image) != (size_t) GetBlobSize(image))
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- buffer=(unsigned char *) AcquireQuantumMemory((size_t) GetBlobSize(image),
- sizeof(*buffer));
+ buffer=(unsigned char *) AcquireQuantumMemory((size_t) GetBlobSize(image)+
+ MaxTextExtent,sizeof(*buffer));
if (buffer == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
count=ReadBlob(image,(size_t) GetBlobSize(image),buffer);