diff options
| author | Antonin Descampe <antonin@descampe.net> | 2017-08-08 16:51:54 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-08 16:51:54 -0700 |
| commit | 0394f8d0f1c981e0bc587beddc14d1fb0b265b1b (patch) | |
| tree | 568c654ba7aaa5a6872875d4c61ec02b459e7497 /src/bin/common | |
| parent | 3b1b0672663b59853b63d48f94b63ca497883527 (diff) | |
| parent | bc3cb7410023e9d0c7ff9972a0bc8cf1fe9b32a4 (diff) | |
Merge pull request #975 from szukw000/changes-for-afl-tests
Catch images broken by AFL
Diffstat (limited to 'src/bin/common')
| -rw-r--r-- | src/bin/common/color.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/bin/common/color.c b/src/bin/common/color.c index 185b547e..a97d49f1 100644 --- a/src/bin/common/color.c +++ b/src/bin/common/color.c @@ -486,6 +486,34 @@ void color_apply_icc_profile(opj_image_t *image) prec = (int)image->comps[0].prec; if (out_space == cmsSigRgbData) { /* enumCS 16 */ + unsigned int i, nr_comp = image->numcomps; + + if (nr_comp > 4) { + nr_comp = 4; + } + for (i = 1; i < nr_comp; ++i) { /* AFL test */ + if (image->comps[0].dx != image->comps[i].dx) { + break; + } + + if (image->comps[0].dy != image->comps[i].dy) { + break; + } + + if (image->comps[0].prec != image->comps[i].prec) { + break; + } + + if (image->comps[0].sgnd != image->comps[i].sgnd) { + break; + } + + } + if (i != nr_comp) { + cmsCloseProfile(in_prof); + return; + } + if (prec <= 8) { in_type = TYPE_RGB_8; out_type = TYPE_RGB_8; |
