Skip to content

Commit 162f619

Browse files
committed
Fix Heap Buffer Overflow in function color_cmyk_to_rgb
Fix uclouvain#774
1 parent 8f9cc62 commit 162f619

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/bin/common/color.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,14 @@ void color_cmyk_to_rgb(opj_image_t *image)
855855
w = image->comps[0].w;
856856
h = image->comps[0].h;
857857

858-
if(image->numcomps < 4) return;
858+
if (
859+
(image->numcomps < 4)
860+
|| (image->comps[0].dx != image->comps[1].dx) || (image->comps[0].dx != image->comps[2].dx) || (image->comps[0].dx != image->comps[3].dx)
861+
|| (image->comps[0].dy != image->comps[1].dy) || (image->comps[0].dy != image->comps[2].dy) || (image->comps[0].dy != image->comps[3].dy)
862+
) {
863+
fprintf(stderr,"%s:%d:color_cmyk_to_rgb\n\tCAN NOT CONVERT\n", __FILE__,__LINE__);
864+
return;
865+
}
859866

860867
max = w * h;
861868

tests/nonregression/test_suite.ctest.in

+2
Original file line numberDiff line numberDiff line change
@@ -559,3 +559,5 @@ opj_decompress -i @INPUT_NR_PATH@/basn6a08.jp2 -o @TEMP_PATH@/basn6a08_tif-15.ti
559559
opj_decompress -i @INPUT_NR_PATH@/issue726.j2k -o @TEMP_PATH@/issue726.png
560560
# issue 733
561561
!opj_decompress -i @INPUT_NR_PATH@/issue733.jp2 -o @TEMP_PATH@/issue733.png
562+
# issue 774
563+
!opj_decompress -i @INPUT_NR_PATH@/issue774.jp2 -o @TEMP_PATH@/issue774.png

0 commit comments

Comments
 (0)