mirror of
https://gitlab.com/libtiff/libtiff.git
synced 2026-01-18 21:51:18 +01:00
Merge branch 'raw2tiff-742' into 'master'
raw2tiff: close input file before exit; issue #742 See merge request libtiff/libtiff!761
This commit is contained in:
@@ -216,11 +216,15 @@ int main(int argc, char *argv[])
|
||||
if (nbands == 0)
|
||||
{
|
||||
fprintf(stderr, "The number of bands is illegal.\n");
|
||||
close(fd);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (guessSize(fd, dtype, hdr_size, nbands, swab, &width, &length) < 0)
|
||||
{
|
||||
close(fd);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* check for integer overflow in */
|
||||
/* hdr_size + (*width) * (*length) * nbands * depth */
|
||||
@@ -228,6 +232,7 @@ int main(int argc, char *argv[])
|
||||
if ((width == 0) || (length == 0))
|
||||
{
|
||||
fprintf(stderr, "Too large nbands value specified.\n");
|
||||
close(fd);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -236,6 +241,7 @@ int main(int argc, char *argv[])
|
||||
if (!temp_limit_check || length > (UINT_MAX / temp_limit_check))
|
||||
{
|
||||
fprintf(stderr, "Too large length size specified.\n");
|
||||
close(fd);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
temp_limit_check = temp_limit_check * length;
|
||||
@@ -243,6 +249,7 @@ int main(int argc, char *argv[])
|
||||
if (!temp_limit_check || width > (UINT_MAX / temp_limit_check))
|
||||
{
|
||||
fprintf(stderr, "Too large width size specified.\n");
|
||||
close(fd);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
temp_limit_check = temp_limit_check * width;
|
||||
@@ -250,6 +257,7 @@ int main(int argc, char *argv[])
|
||||
if (!temp_limit_check || hdr_size > (UINT_MAX - temp_limit_check))
|
||||
{
|
||||
fprintf(stderr, "Too large header size specified.\n");
|
||||
close(fd);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -260,6 +268,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
fprintf(stderr, "%s: %s: Cannot open file for output.\n", argv[0],
|
||||
outfilename);
|
||||
close(fd);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);
|
||||
@@ -387,6 +396,7 @@ int main(int argc, char *argv[])
|
||||
if (buf1)
|
||||
_TIFFfree(buf1);
|
||||
TIFFClose(out);
|
||||
close(fd);
|
||||
return (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user