summaryrefslogtreecommitdiff
path: root/media-libs/tiff/files/tiff-4.0.7-bug2631.patch
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/tiff/files/tiff-4.0.7-bug2631.patch')
-rw-r--r--media-libs/tiff/files/tiff-4.0.7-bug2631.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/media-libs/tiff/files/tiff-4.0.7-bug2631.patch b/media-libs/tiff/files/tiff-4.0.7-bug2631.patch
new file mode 100644
index 000000000000..6e1011b072dc
--- /dev/null
+++ b/media-libs/tiff/files/tiff-4.0.7-bug2631.patch
@@ -0,0 +1,34 @@
+From 101253c74cde97203dab28c4f3bd0994cea5804c Mon Sep 17 00:00:00 2001
+From: Even Rouault <even.rouault@spatialys.com>
+Date: Sat, 14 Jan 2017 13:12:33 +0000
+Subject: [PATCH] * tools/raw2tiff.c: avoid integer division by zero. Fixes
+ http://bugzilla.maptools.org/show_bug.cgi?id=2631
+
+---
+ ChangeLog | 5 +++++
+ tools/raw2tiff.c | 10 ++++++++--
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/tools/raw2tiff.c b/tools/raw2tiff.c
+index 7298e80a95c9..083e9ee73f0f 100644
+--- a/tools/raw2tiff.c
++++ b/tools/raw2tiff.c
+@@ -408,8 +408,14 @@ guessSize(int fd, TIFFDataType dtype, _TIFF_off_t hdr_size, uint32 nbands,
+ } else if (*width == 0 && *length == 0) {
+ unsigned int fail = 0;
+ fprintf(stderr, "Image width and height are not specified.\n");
++ w = (uint32) sqrt(imagesize / longt);
++ if( w == 0 )
++ {
++ fprintf(stderr, "Too small image size.\n");
++ return -1;
++ }
+
+- for (w = (uint32) sqrt(imagesize / longt);
++ for (;
+ w < sqrt(imagesize * longt);
+ w++) {
+ if (imagesize % w == 0) {
+--
+2.12.0
+