mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2026-06-25 15:19:09 -04:00
JP2: limits the maximum number of channels to the global value defined
This commit is contained in:
@@ -186,7 +186,7 @@ public:
|
|||||||
|
|
||||||
bool isImageValid(const opj_image_t *i) const
|
bool isImageValid(const opj_image_t *i) const
|
||||||
{
|
{
|
||||||
return i && i->comps && i->numcomps > 0 && i->numcomps < 256;
|
return i && i->comps && i->numcomps > 0 && i->numcomps <= KIF_MAX_IMAGE_CHANNELS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableThreads(opj_codec_t *codec) const
|
void enableThreads(opj_codec_t *codec) const
|
||||||
@@ -347,11 +347,16 @@ public:
|
|||||||
|
|
||||||
bool checkSizeLimits(qint32 width, qint32 height, qint32 nchannels) const
|
bool checkSizeLimits(qint32 width, qint32 height, qint32 nchannels) const
|
||||||
{
|
{
|
||||||
if (width > JP2_MAX_IMAGE_WIDTH || height > JP2_MAX_IMAGE_HEIGHT || width < 1 || height < 1) {
|
if (width > JP2_MAX_IMAGE_WIDTH || height > JP2_MAX_IMAGE_HEIGHT) {
|
||||||
qCCritical(LOG_JP2PLUGIN) << "Maximum image size is limited to" << JP2_MAX_IMAGE_WIDTH << "x" << JP2_MAX_IMAGE_HEIGHT << "pixels";
|
qCCritical(LOG_JP2PLUGIN) << "Maximum image size is limited to" << JP2_MAX_IMAGE_WIDTH << "x" << JP2_MAX_IMAGE_HEIGHT << "pixels";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (width < 1 || height < 1) {
|
||||||
|
qCCritical(LOG_JP2PLUGIN) << "The image size" << width << "x" << height << "pixels is not valid";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (qint64(width) * qint64(height) > JP2_MAX_IMAGE_PIXELS) {
|
if (qint64(width) * qint64(height) > JP2_MAX_IMAGE_PIXELS) {
|
||||||
qCCritical(LOG_JP2PLUGIN) << "Maximum image size is limited to" << JP2_MAX_IMAGE_PIXELS << "pixels";
|
qCCritical(LOG_JP2PLUGIN) << "Maximum image size is limited to" << JP2_MAX_IMAGE_PIXELS << "pixels";
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user