diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c index 7205ccf9..73885f7d 100644 --- a/src/bin/jp2/convert.c +++ b/src/bin/jp2/convert.c @@ -2016,7 +2016,7 @@ int imagetopnm(opj_image_t * image, const char *outfile, int force_split) int *red, *green, *blue, *alpha; int wr, hr, max; int i; - unsigned int compno, ncomp; + unsigned int compno, ncomp, ui; int adjustR, adjustG, adjustB, adjustA; int fails, two, want_gray, has_alpha, triple; int prec, v; @@ -2024,6 +2024,18 @@ int imagetopnm(opj_image_t * image, const char *outfile, int force_split) const char *tmp = outfile; char *destname; + fails = 0; + ncomp = image->numcomps; + for(ui = 0; ui < ncomp; ++ui) { + if(image->comps[ui].data == NULL) { + fprintf(stderr, "imagetopnm data[%u] == NULL\n",ui); + fails = 1; + } + } + if(fails) { + return 1; + } + alpha = NULL; if ((prec = (int)image->comps[0].prec) > 16) { diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index c32cc3dc..bc2086c9 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -578,11 +578,16 @@ static int infile_format(const char *fname) } s = fname + strlen(fname) - 4; - - fputs("\n===========================================\n", stderr); + while(*s) { + if(*s == '.') { + break; + } + ++s; + } + fputs("\n===============================================\n", stderr); fprintf(stderr, "The extension of this file is incorrect.\n" - "FOUND %s. SHOULD BE %s\n", s, magic_s); - fputs("===========================================\n", stderr); + " FOUND '%s'. SHOULD BE '%s'", s, magic_s); + fputs("\n===============================================\n", stderr); return magic_format; }