diff --git a/src/add-ons/translators/psd/PSDLoader.cpp b/src/add-ons/translators/psd/PSDLoader.cpp index 0d7cb76671..a7e606c6a7 100644 --- a/src/add-ons/translators/psd/PSDLoader.cpp +++ b/src/add-ons/translators/psd/PSDLoader.cpp @@ -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]; diff --git a/src/add-ons/translators/psd/PSDLoader.h b/src/add-ons/translators/psd/PSDLoader.h index e7dcb2568a..4e6a85263b 100644 --- a/src/add-ons/translators/psd/PSDLoader.h +++ b/src/add-ons/translators/psd/PSDLoader.h @@ -22,6 +22,8 @@ #include #include +#define PSD_MAX_CHANNELS 16 + enum psd_compressed_type { PSD_COMPRESSED_RAW = 0,