Skip to content

Commit

Permalink
Fix heap-buffer-overflow in color_esycc_to_rgb (#748)
Browse files Browse the repository at this point in the history
When all components do not have the same dx/dy, components buffer are
read beyond their end.
Do not convert in this case.

Update #725
  • Loading branch information
mayeut committed Apr 29, 2016
1 parent 319fc97 commit ad593c9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/bin/common/color.c
Expand Up @@ -890,7 +890,14 @@ void color_esycc_to_rgb(opj_image_t *image)
int flip_value = (1 << (image->comps[0].prec-1));
int max_value = (1 << image->comps[0].prec) - 1;

if(image->numcomps < 3) return;
if (
(image->numcomps < 3)
|| (image->comps[0].dx != image->comps[1].dx) || (image->comps[0].dx != image->comps[2].dx)
|| (image->comps[0].dy != image->comps[1].dy) || (image->comps[0].dy != image->comps[2].dy)
) {
fprintf(stderr,"%s:%d:color_esycc_to_rgb\n\tCAN NOT CONVERT\n", __FILE__,__LINE__);
return;
}

w = image->comps[0].w;
h = image->comps[0].h;
Expand Down

0 comments on commit ad593c9

Please sign in to comment.