diff options
| author | szukw000 <szukw000@arcor.de> | 2017-07-31 13:58:08 +0200 |
|---|---|---|
| committer | szukw000 <szukw000@arcor.de> | 2017-07-31 13:58:08 +0200 |
| commit | 00f45684a8339e69ed55df2397f3c19d09fecaed (patch) | |
| tree | 171f881e7b3bcad1afed20d69aa7a8c02ec9dad8 /src/bin/jp2/convertbmp.c | |
| parent | 13cde9fa37249628af6b6f10601b733f87a025f4 (diff) | |
Catch images broken by AFL
Diffstat (limited to 'src/bin/jp2/convertbmp.c')
| -rw-r--r-- | src/bin/jp2/convertbmp.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/bin/jp2/convertbmp.c b/src/bin/jp2/convertbmp.c index 5152ca6f..a636ddc5 100644 --- a/src/bin/jp2/convertbmp.c +++ b/src/bin/jp2/convertbmp.c @@ -832,7 +832,8 @@ int imagetobmp(opj_image_t * image, const char *outfile) int adjustR, adjustG, adjustB; if (image->comps[0].prec < 8) { - fprintf(stderr, "Unsupported number of components: %d\n", image->comps[0].prec); + fprintf(stderr, "imagetobmp: Unsupported precision: %d\n", + image->comps[0].prec); return 1; } if (image->numcomps >= 3 && image->comps[0].dx == image->comps[1].dx @@ -840,7 +841,9 @@ int imagetobmp(opj_image_t * image, const char *outfile) && image->comps[0].dy == image->comps[1].dy && image->comps[1].dy == image->comps[2].dy && image->comps[0].prec == image->comps[1].prec - && image->comps[1].prec == image->comps[2].prec) { + && image->comps[1].prec == image->comps[2].prec + && image->comps[0].sgnd == image->comps[1].sgnd + && image->comps[1].sgnd == image->comps[2].sgnd) { /* -->> -->> -->> -->> 24 bits color @@ -974,6 +977,10 @@ int imagetobmp(opj_image_t * image, const char *outfile) fprintf(stderr, "ERROR -> failed to open %s for writing\n", outfile); return 1; } + if (image->numcomps > 1) { + fprintf(stderr, "imagetobmp: only first component of %d is used.\n", + image->numcomps); + } w = (int)image->comps[0].w; h = (int)image->comps[0].h; |
