summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormayeut <mayeut@users.noreply.github.com>2016-05-08 19:18:05 +0200
committermayeut <mayeut@users.noreply.github.com>2016-05-08 19:18:05 +0200
commit162f6199c0cd3ec1c6c6dc65e41b2faab92b2d91 (patch)
treef0305a60841868149e46aef917b86b8d17d9c9b9 /src
parent8f9cc62b3f9a1da9712329ddcedb9750d585505c (diff)
Fix Heap Buffer Overflow in function color_cmyk_to_rgb
Fix uclouvain/openjpeg#774
Diffstat (limited to 'src')
-rw-r--r--src/bin/common/color.c9
1 files changed, 8 insertions, 1 deletions
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;