You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/media-libs/tiff/files/tiff-4.0.7-bug2631.patch

35 lines
1.1 KiB

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