libtiff/tif_print.c: TIFFPrintDirectory(): fix null pointer dereference on corrupted file. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2770

This commit is contained in:
Even Rouault 2017-12-31 15:09:41 +01:00
parent 5848777bd7
commit c6f41df7b5

View File

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