Skip to content

Commit

Permalink
Fix Heap Buffer Overflow in function color_cmyk_to_rgb
Browse files Browse the repository at this point in the history
Fix #774
  • Loading branch information
mayeut committed May 8, 2016
1 parent 8f9cc62 commit 162f619
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/bin/common/color.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions tests/nonregression/test_suite.ctest.in
Original file line number Diff line number Diff line change
Expand Up @@ -559,3 +559,5 @@ opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-15.ti
opj_decompress -i @INPUT_NR_PATH@/issue726.j2k -o @TEMP_PATH@/issue726.png
# issue 733
!opj_decompress -i @INPUT_NR_PATH@/issue733.jp2 -o @TEMP_PATH@/issue733.png
# issue 774
!opj_decompress -i @INPUT_NR_PATH@/issue774.jp2 -o @TEMP_PATH@/issue774.png

0 comments on commit 162f619

Please sign in to comment.