From 6832c5c251608461b3fcba58bd8c6fa2b1a57639 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sun, 5 Aug 2012 13:54:08 +0200 Subject: Free decoded jpx image upon error Thanks to Zeniko for pointing out this fix. --- fitz/image_jpx.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'fitz') diff --git a/fitz/image_jpx.c b/fitz/image_jpx.c index af5ef263..04bcfecd 100644 --- a/fitz/image_jpx.c +++ b/fitz/image_jpx.c @@ -70,11 +70,20 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs for (k = 1; k < jpx->numcomps; k++) { if (jpx->comps[k].w != jpx->comps[0].w) + { + opj_image_destroy(jpx); fz_throw(ctx, "image components have different width"); + } if (jpx->comps[k].h != jpx->comps[0].h) + { + opj_image_destroy(jpx); fz_throw(ctx, "image components have different height"); + } if (jpx->comps[k].prec != jpx->comps[0].prec) + { + opj_image_destroy(jpx); fz_throw(ctx, "image components have different precision"); + } } n = jpx->numcomps; -- cgit v1.2.3