[CVE-2017-18013] Apply CVE patch 43/178743/1
authorJiyong Min <jiyong.min@samsung.com>
Sun, 13 May 2018 22:54:01 +0000 (07:54 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Sun, 13 May 2018 22:55:17 +0000 (07:55 +0900)
Change-Id: I663956752d932fc080d5002cf4e33ed55f8205b5

libtiff/tif_print.c

index 24d4b98..f494cfb 100644 (file)
@@ -667,13 +667,13 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
 #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
                        fprintf(fd, "    %3lu: [%8I64u, %8I64u]\n",
                            (unsigned long) s,
-                           (unsigned __int64) td->td_stripoffset[s],
-                           (unsigned __int64) td->td_stripbytecount[s]);
+                           td->td_stripoffset ? (unsigned __int64) td->td_stripoffset[s] : 0,
+                           td->td_stripbytecount ? (unsigned __int64) td->td_stripbytecount[s] : 0);
 #else
                        fprintf(fd, "    %3lu: [%8llu, %8llu]\n",
                            (unsigned long) s,
-                           (unsigned long long) td->td_stripoffset[s],
-                           (unsigned long long) td->td_stripbytecount[s]);
+                           td->td_stripoffset ? (unsigned long long) td->td_stripoffset[s] : 0,
+                           td->td_stripbytecount ? (unsigned long long) td->td_stripbytecount[s] : 0);
 #endif
        }
 }