35 lines
834 B
Diff
35 lines
834 B
Diff
From 42f499986d3c8a1dce55db7d97d501f8e9dfc8f6 Mon Sep 17 00:00:00 2001
|
|
From: t.feng <fengtao40@huawei.com>
|
|
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
|
|
|