From 390c39fce9eb71da944978c6495b732681ce5ccd Mon Sep 17 00:00:00 2001 From: cristy Date: Tue, 5 Oct 2010 23:41:44 +0000 Subject: [PATCH] --- ChangeLog | 1 + coders/psd.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f0e885e0..782ae3691 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ 2010-10-05 6.6.4-10 Cristy * Add support for "pattern:vertical2" and "pattern:horizontal2". * Add support for "pattern:vertical3" and "pattern:horizontal3". + * Properly handle PSD layers with negative heights. 2010-10-03 6.6.4-9 Cristy * Fix memory assertion with --enable-embeddable (reference diff --git a/coders/psd.c b/coders/psd.c index 5731582c4..f91cafbc7 100644 --- a/coders/psd.c +++ b/coders/psd.c @@ -1000,9 +1000,9 @@ static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception) " reading layer #%.20g",(double) i+1); layer_info[i].page.y=(int) ReadBlobMSBLong(image); layer_info[i].page.x=(int) ReadBlobMSBLong(image); - layer_info[i].page.height=(size_t) + layer_info[i].page.height=(ssize_t) (ReadBlobMSBLong(image)-layer_info[i].page.y); - layer_info[i].page.width=(size_t) + layer_info[i].page.width=(ssize_t) (ReadBlobMSBLong(image)-layer_info[i].page.x); layer_info[i].channels=ReadBlobMSBShort(image); if (layer_info[i].channels > MaxPSDChannels) @@ -1166,7 +1166,8 @@ static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception) Allocate layered image. */ layer_info[i].image=CloneImage(image,layer_info[i].page.width, - layer_info[i].page.height,MagickFalse,&image->exception); + layer_info[i].page.height == ~0U ? 1 : layer_info[i].page.height, + MagickFalse,&image->exception); if (layer_info[i].image == (Image *) NULL) { for (j=0; j < i; j++) -- 2.40.0