summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2012-08-05 13:54:08 +0200
committerSebastian Rasmussen <sebras@gmail.com>2012-08-06 13:59:41 +0200
commit6832c5c251608461b3fcba58bd8c6fa2b1a57639 (patch)
tree4a2273c44db1d82b0851e10c18f77e6a97a78a42
parentcbfdbd9463ca131f37aded2de7fd52b46e47eb8f (diff)
downloadmupdf-6832c5c251608461b3fcba58bd8c6fa2b1a57639.tar.xz
Free decoded jpx image upon error
Thanks to Zeniko for pointing out this fix.
-rw-r--r--fitz/image_jpx.c9
1 files changed, 9 insertions, 0 deletions
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;