diff --git a/fix-raw2tiff-floating-point-exception.patch b/fix-raw2tiff-floating-point-exception.patch new file mode 100644 index 0000000..ca217c8 --- /dev/null +++ b/fix-raw2tiff-floating-point-exception.patch @@ -0,0 +1,34 @@ +From 42f499986d3c8a1dce55db7d97d501f8e9dfc8f6 Mon Sep 17 00:00:00 2001 +From: t.feng +Date: Mon, 13 Dec 2021 21:03:13 +0800 +Subject: [PATCH] fix raw2tiff floating point exception + +if we input illegal nbands, like: +raw2tiff -b :2 test.raw test.tif +we got: +Floating point exception (core dumped) +so, check nbands before guessSize + +--- + tools/raw2tiff.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/tools/raw2tiff.c b/tools/raw2tiff.c +index dfee715..3a6f00e 100644 +--- a/tools/raw2tiff.c ++++ b/tools/raw2tiff.c +@@ -209,6 +209,11 @@ main(int argc, char* argv[]) + return (EXIT_FAILURE); + } + ++ if (nbands == 0) { ++ fprintf(stderr, "The number of bands is illegal.\n"); ++ return (-1); ++ } ++ + if (guessSize(fd, dtype, hdr_size, nbands, swab, &width, &length) < 0) + return EXIT_FAILURE; + +-- +2.27.0 + diff --git a/libtiff.spec b/libtiff.spec index 68c8ea9..8e3ae84 100644 --- a/libtiff.spec +++ b/libtiff.spec @@ -1,11 +1,13 @@ Name: libtiff Version: 4.3.0 -Release: 3 +Release: 4 Summary: TIFF Library and Utilities License: libtiff URL: https://www.simplesystems.org/libtiff/ Source0: https://download.osgeo.org/libtiff/tiff-%{version}.tar.gz +Patch9000: fix-raw2tiff-floating-point-exception.patch + BuildRequires: gcc gcc-c++ zlib-devel libjpeg-devel jbigkit-devel BuildRequires: libtool automake autoconf pkgconfig @@ -112,6 +114,9 @@ find html -name 'Makefile*' | xargs rm %exclude %{_datadir}/html/man/tiffgt.1.html %changelog +* Wed Dec 15 2021 liuyumeng - 4.3.0-4 +- fix raw2tiff floating point exception + * Mon Dec 13 2021 liuyumeng - 4.3.0-3 - fix incorrect writing when unpacking in spec