#include "MagickCore/profile.h"
#include "MagickCore/property.h"
#include "MagickCore/quantum-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/semaphore.h"
#include "MagickCore/static.h"
#include "MagickCore/statistic.h"
ThrowReaderException(DelegateError,"UnableToDecodeImageFile");
}
}
- if ((image_info->number_scenes != 0) && (image_info->scene != 0))
+ if ((AcquireMagickResource(WidthResource,(size_t) jp2_image->comps[0].w) == MagickFalse) ||
+ (AcquireMagickResource(HeightResource,(size_t) jp2_image->comps[0].h) == MagickFalse))
+ {
+ opj_stream_destroy(jp2_stream);
+ opj_destroy_codec(jp2_codec);
+ opj_image_destroy(jp2_image);
+ ThrowReaderException(DelegateError,"UnableToDecodeImageFile");
+ }
+ if ((image_info->number_scenes != 0) && (image_info->scene != 0))
jp2_status=opj_get_decoded_tile(jp2_codec,jp2_stream,jp2_image,
(unsigned int) image_info->scene-1);
else