|
|
21ff78 |
From b1997b9c3ac0d6bac5effd7558141986487217a9 Mon Sep 17 00:00:00 2001
|
|
|
21ff78 |
From: Even Rouault <even.rouault@spatialys.com>
|
|
|
21ff78 |
Date: Sun, 31 Dec 2017 15:09:41 +0100
|
|
|
21ff78 |
Subject: [PATCH 2/4] libtiff/tif_print.c: TIFFPrintDirectory(): fix null
|
|
|
21ff78 |
pointer dereference on corrupted file. Fixes
|
|
|
21ff78 |
http://bugzilla.maptools.org/show_bug.cgi?id=2770 / CVE-2017-18013
|
|
|
21ff78 |
|
|
|
21ff78 |
---
|
|
|
21ff78 |
libtiff/tif_print.c | 8 ++++----
|
|
|
21ff78 |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
21ff78 |
|
|
|
21ff78 |
diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c
|
|
|
21ff78 |
index 10a588e..b9b53a0 100644
|
|
|
21ff78 |
--- a/libtiff/tif_print.c
|
|
|
21ff78 |
+++ b/libtiff/tif_print.c
|
|
|
21ff78 |
@@ -667,13 +667,13 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
|
|
|
21ff78 |
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
|
|
|
21ff78 |
fprintf(fd, " %3lu: [%8I64u, %8I64u]\n",
|
|
|
21ff78 |
(unsigned long) s,
|
|
|
21ff78 |
- (unsigned __int64) td->td_stripoffset[s],
|
|
|
21ff78 |
- (unsigned __int64) td->td_stripbytecount[s]);
|
|
|
21ff78 |
+ td->td_stripoffset ? (unsigned __int64) td->td_stripoffset[s] : 0,
|
|
|
21ff78 |
+ td->td_stripbytecount ? (unsigned __int64) td->td_stripbytecount[s] : 0);
|
|
|
21ff78 |
#else
|
|
|
21ff78 |
fprintf(fd, " %3lu: [%8llu, %8llu]\n",
|
|
|
21ff78 |
(unsigned long) s,
|
|
|
21ff78 |
- (unsigned long long) td->td_stripoffset[s],
|
|
|
21ff78 |
- (unsigned long long) td->td_stripbytecount[s]);
|
|
|
21ff78 |
+ td->td_stripoffset ? (unsigned long long) td->td_stripoffset[s] : 0,
|
|
|
21ff78 |
+ td->td_stripbytecount ? (unsigned long long) td->td_stripbytecount[s] : 0);
|
|
|
21ff78 |
#endif
|
|
|
21ff78 |
}
|
|
|
21ff78 |
}
|
|
|
21ff78 |
--
|
|
|
21ff78 |
2.17.0
|
|
|
21ff78 |
|