PSDTranslator: Fix array size

This commit is contained in:
Gerasim Troeglazov 2013-12-18 09:56:11 +00:00
parent af6518e48e
commit 63b8eb480e
2 changed files with 4 additions and 2 deletions

View File

@ -77,7 +77,7 @@ PSDLoader::IsSupported(void)
if (fVersion != 1)
return false;
if (fChannels < 0 || fChannels > 16)
if (fChannels < 0 || fChannels > PSD_MAX_CHANNELS)
return false;
if (fDepth > 16)
@ -190,7 +190,7 @@ PSDLoader::Decode(BPositionIO *target)
int32 rowBytes = (fWidth * fDepth) / 8;
int32 channelBytes = rowBytes * fHeight;
uint8 *imageData[5];
uint8 *imageData[PSD_MAX_CHANNELS];
for (int i = 0; i < fChannels; i++)
imageData[i] = new uint8[channelBytes];

View File

@ -22,6 +22,8 @@
#include <ByteOrder.h>
#include <List.h>
#define PSD_MAX_CHANNELS 16
enum psd_compressed_type {
PSD_COMPRESSED_RAW = 0,