From 162f6199c0cd3ec1c6c6dc65e41b2faab92b2d91 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sun, 8 May 2016 19:18:05 +0200 Subject: Fix Heap Buffer Overflow in function color_cmyk_to_rgb Fix uclouvain/openjpeg#774 --- src/bin/common/color.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/bin/common/color.c b/src/bin/common/color.c index 944df73b..234c7bdf 100644 --- a/src/bin/common/color.c +++ b/src/bin/common/color.c @@ -855,7 +855,14 @@ void color_cmyk_to_rgb(opj_image_t *image) w = image->comps[0].w; h = image->comps[0].h; - if(image->numcomps < 4) return; + if ( + (image->numcomps < 4) + || (image->comps[0].dx != image->comps[1].dx) || (image->comps[0].dx != image->comps[2].dx) || (image->comps[0].dx != image->comps[3].dx) + || (image->comps[0].dy != image->comps[1].dy) || (image->comps[0].dy != image->comps[2].dy) || (image->comps[0].dy != image->comps[3].dy) + ) { + fprintf(stderr,"%s:%d:color_cmyk_to_rgb\n\tCAN NOT CONVERT\n", __FILE__,__LINE__); + return; + } max = w * h; -- cgit v1.2.3