|
Lines 508-513
Link Here
|
| 508 |
|
508 |
|
| 509 |
static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception) |
509 |
static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception) |
| 510 |
{ |
510 |
{ |
|
|
511 |
#define MaxPSDChannels 24 |
| 512 |
|
| 511 |
typedef struct _ChannelInfo |
513 |
typedef struct _ChannelInfo |
| 512 |
{ |
514 |
{ |
| 513 |
short int |
515 |
short int |
|
Lines 527-533
Link Here
|
| 527 |
channels; |
529 |
channels; |
| 528 |
|
530 |
|
| 529 |
ChannelInfo |
531 |
ChannelInfo |
| 530 |
channel_info[24]; |
532 |
channel_info[MaxPSDChannels]; |
| 531 |
|
533 |
|
| 532 |
char |
534 |
char |
| 533 |
blendkey[4]; |
535 |
blendkey[4]; |
|
Lines 656-679
Link Here
|
| 656 |
count=ReadBlob(image,4,(unsigned char *) psd_info.signature); |
658 |
count=ReadBlob(image,4,(unsigned char *) psd_info.signature); |
| 657 |
psd_info.version=ReadBlobMSBShort(image); |
659 |
psd_info.version=ReadBlobMSBShort(image); |
| 658 |
if ((count == 0) || (LocaleNCompare(psd_info.signature,"8BPS",4) != 0) || |
660 |
if ((count == 0) || (LocaleNCompare(psd_info.signature,"8BPS",4) != 0) || |
| 659 |
(psd_info.version != 1)) { |
661 |
(psd_info.version != 1)) |
| 660 |
if (image->debug != MagickFalse) |
|
|
| 661 |
(void) LogMagickEvent(CoderEvent,GetMagickModule(), |
| 662 |
" File signature was %.4s instead of '8BPS'",psd_info.signature); |
| 663 |
ThrowReaderException(CorruptImageError,"ImproperImageHeader"); |
662 |
ThrowReaderException(CorruptImageError,"ImproperImageHeader"); |
| 664 |
} |
|
|
| 665 |
(void) ReadBlob(image,6,psd_info.reserved); |
663 |
(void) ReadBlob(image,6,psd_info.reserved); |
| 666 |
psd_info.channels=ReadBlobMSBShort(image); |
664 |
psd_info.channels=ReadBlobMSBShort(image); |
|
|
665 |
if (psd_info.channels > MaxPSDChannels) |
| 666 |
ThrowReaderException(CorruptImageError,"MaximumChannelsExceeded"); |
| 667 |
psd_info.rows=ReadBlobMSBLong(image); |
667 |
psd_info.rows=ReadBlobMSBLong(image); |
| 668 |
psd_info.columns=ReadBlobMSBLong(image); |
668 |
psd_info.columns=ReadBlobMSBLong(image); |
| 669 |
psd_info.depth=ReadBlobMSBShort(image); |
669 |
psd_info.depth=ReadBlobMSBShort(image); |
| 670 |
psd_info.mode=ReadBlobMSBShort(image); |
670 |
psd_info.mode=ReadBlobMSBShort(image); |
| 671 |
|
|
|
| 672 |
if (image->debug != MagickFalse) |
671 |
if (image->debug != MagickFalse) |
| 673 |
(void) LogMagickEvent(CoderEvent,GetMagickModule(), |
672 |
(void) LogMagickEvent(CoderEvent,GetMagickModule(), |
| 674 |
" Image is %ld x %ld with channels=%d, depth=%d, mode=%s", |
673 |
" Image is %ld x %ld with channels=%d, depth=%d, mode=%s", |
| 675 |
psd_info.columns, psd_info.rows, psd_info.channels, |
674 |
psd_info.columns,psd_info.rows,psd_info.channels,psd_info.depth, |
| 676 |
psd_info.depth, ModeToString((PSDImageType) psd_info.mode)); |
675 |
ModeToString((PSDImageType) psd_info.mode)); |
| 677 |
/* |
676 |
/* |
| 678 |
Initialize image. |
677 |
Initialize image. |
| 679 |
*/ |
678 |
*/ |