summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authormayeut <mayeut@users.noreply.github.com>2015-07-19 15:01:12 +0200
committermayeut <mayeut@users.noreply.github.com>2015-07-19 15:01:12 +0200
commit46c1dd22fc6d6a8b8f2b54f9e42e1fe5ba4938a7 (patch)
tree67db06e73619fa2a0ab604fcf2dc404c2aa247a6 /src/bin
parent06f6911d7bd41a2689e56e0195e5713d8cd5b7f7 (diff)
Correct error message for invalid TIFF input
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/jp2/converttif.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/bin/jp2/converttif.c b/src/bin/jp2/converttif.c
index d93e5f53..e8ff38f3 100644
--- a/src/bin/jp2/converttif.c
+++ b/src/bin/jp2/converttif.c
@@ -825,18 +825,14 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
w= (int)tiWidth;
h= (int)tiHeight;
- if((tiBps > 16U) || ((tiBps != 1U) && (tiBps & 1U))) tiBps = 0U;
- if(tiPhoto != PHOTOMETRIC_MINISBLACK && tiPhoto != PHOTOMETRIC_RGB) tiPhoto = 0;
-
- if( !tiBps || !tiPhoto)
- {
- if( !tiBps)
- fprintf(stderr,"tiftoimage: Bits=%d, Only 1, 2, 4, 6, 8, 10, 12, 14 and 16 bits implemented\n",tiBps);
- else
- if( !tiPhoto)
- fprintf(stderr,"tiftoimage: Bad color format %d.\n\tOnly RGB(A)"
- " and GRAY(A) has been implemented\n",(int) tiPhoto);
-
+ if((tiBps > 16U) || ((tiBps != 1U) && (tiBps & 1U))) {
+ fprintf(stderr,"tiftoimage: Bits=%d, Only 1, 2, 4, 6, 8, 10, 12, 14 and 16 bits implemented\n",tiBps);
+ fprintf(stderr,"\tAborting\n");
+ TIFFClose(tif);
+ return NULL;
+ }
+ if(tiPhoto != PHOTOMETRIC_MINISBLACK && tiPhoto != PHOTOMETRIC_RGB) {
+ fprintf(stderr,"tiftoimage: Bad color format %d.\n\tOnly RGB(A) and GRAY(A) has been implemented\n",(int) tiPhoto);
fprintf(stderr,"\tAborting\n");
TIFFClose(tif);
return NULL;