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.

36 lines
1.4 KiB

  1. From b1997b9c3ac0d6bac5effd7558141986487217a9 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 2/4] libtiff/tif_print.c: TIFFPrintDirectory(): fix null
  5. pointer dereference on corrupted file. Fixes
  6. http://bugzilla.maptools.org/show_bug.cgi?id=2770 / CVE-2017-18013
  7. ---
  8. libtiff/tif_print.c | 8 ++++----
  9. 1 file changed, 4 insertions(+), 4 deletions(-)
  10. diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c
  11. index 10a588e..b9b53a0 100644
  12. --- a/libtiff/tif_print.c
  13. +++ b/libtiff/tif_print.c
  14. @@ -667,13 +667,13 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
  15. #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
  16. fprintf(fd, " %3lu: [%8I64u, %8I64u]\n",
  17. (unsigned long) s,
  18. - (unsigned __int64) td->td_stripoffset[s],
  19. - (unsigned __int64) td->td_stripbytecount[s]);
  20. + td->td_stripoffset ? (unsigned __int64) td->td_stripoffset[s] : 0,
  21. + td->td_stripbytecount ? (unsigned __int64) td->td_stripbytecount[s] : 0);
  22. #else
  23. fprintf(fd, " %3lu: [%8llu, %8llu]\n",
  24. (unsigned long) s,
  25. - (unsigned long long) td->td_stripoffset[s],
  26. - (unsigned long long) td->td_stripbytecount[s]);
  27. + td->td_stripoffset ? (unsigned long long) td->td_stripoffset[s] : 0,
  28. + td->td_stripbytecount ? (unsigned long long) td->td_stripbytecount[s] : 0);
  29. #endif
  30. }
  31. }
  32. --
  33. 2.17.0