diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2018-08-12 16:56:57 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2018-08-14 20:56:54 +0800 |
commit | 2c9c8b75de448ae0ee1394f672eb0baa4c7dd57a (patch) | |
tree | 06c67eb7caeca6ac9404b739b6c46670a4156c67 /source/fitz/draw-device.c | |
parent | 8aa2bd34065d2844aae778bd4cc20c74bbcd9406 (diff) | |
download | mupdf-2c9c8b75de448ae0ee1394f672eb0baa4c7dd57a.tar.xz |
Bug 698898: Always pop draw stack in case of exception.
When fz_draw_clip_image_mask() calls fz_get_pixmap_from_image()
may throw an exception, in this case beacuse a predicted image
has an unsupported number of components (1, 2, 4, 8 and 16 are
supported, but 6 is not). When this happens the recently pushed
stack element is never popped, which later trips an assert() in
fz_draw_end_group() at a later stage.
By moving the call to fz_get_pixmap_from_image() inside fz_try
the stack will be popped, thus avoiding triggering the assert().
This also requires the pixmap variable to be fz_var()ed because
it changes inside the fz_try-block.
Diffstat (limited to 'source/fitz/draw-device.c')
-rw-r--r-- | source/fitz/draw-device.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index d1b6d54c..1bfb9577 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -1950,6 +1950,8 @@ fz_draw_clip_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, fz_ma fz_colorspace *model = state->dest->colorspace; fz_irect clip; + fz_var(pixmap); + if (dev->top == 0 && dev->resolve_spots) state = push_group_for_separations(ctx, dev, fz_default_color_params(ctx)/* FIXME */, dev->default_cs); @@ -1979,10 +1981,10 @@ fz_draw_clip_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, fz_ma bbox = fz_intersect_irect(bbox, fz_irect_from_rect(tscissor)); } - pixmap = fz_get_pixmap_from_image(ctx, image, NULL, &local_ctm, &dx, &dy); - fz_try(ctx) { + pixmap = fz_get_pixmap_from_image(ctx, image, NULL, &local_ctm, &dx, &dy); + state[1].mask = fz_new_pixmap_with_bbox(ctx, NULL, bbox, NULL, 1); fz_clear_pixmap(ctx, state[1].mask); |