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.

29 lines
1.3 KiB

  1. From c6f41df7b581402dfba3c19a1e3df4454c551a01 Mon Sep 17 00:00:00 2001
  2. From: Even Rouault <even.rouault@spatialys.com>
  3. Date: Sun, 31 Dec 2017 15:09:41 +0100
  4. Subject: [PATCH] libtiff/tif_print.c: TIFFPrintDirectory(): fix null pointer dereference on corrupted file. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2770
  5. ---
  6. libtiff/tif_print.c | 8 ++++----
  7. 1 file changed, 4 insertions(+), 4 deletions(-)
  8. --- a/libtiff/tif_print.c
  9. +++ b/libtiff/tif_print.c
  10. @@ -667,13 +667,13 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd,
  11. #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
  12. fprintf(fd, " %3lu: [%8I64u, %8I64u]\n",
  13. (unsigned long) s,
  14. - (unsigned __int64) td->td_stripoffset[s],
  15. - (unsigned __int64) td->td_stripbytecount[s]);
  16. + td->td_stripoffset ? (unsigned __int64) td->td_stripoffset[s] : 0,
  17. + td->td_stripbytecount ? (unsigned __int64) td->td_stripbytecount[s] : 0);
  18. #else
  19. fprintf(fd, " %3lu: [%8llu, %8llu]\n",
  20. (unsigned long) s,
  21. - (unsigned long long) td->td_stripoffset[s],
  22. - (unsigned long long) td->td_stripbytecount[s]);
  23. + td->td_stripoffset ? (unsigned long long) td->td_stripoffset[s] : 0,
  24. + td->td_stripbytecount ? (unsigned long long) td->td_stripbytecount[s] : 0);
  25. #endif
  26. }
  27. }