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.

45 lines
1.8 KiB

  1. From 69bfeec247899776b1b396651adb47436e5f1556 Mon Sep 17 00:00:00 2001
  2. From: Even Rouault <even.rouault@spatialys.com>
  3. Date: Sat, 15 Jul 2017 11:13:46 +0000
  4. Subject: [PATCH] * tools/tiff2pdf.c: prevent heap buffer overflow write in
  5. "Raw" mode on PlanarConfig=Contig input images. Fixes
  6. http://bugzilla.maptools.org/show_bug.cgi?id=2715 Reported by team OWL337
  7. ---
  8. ChangeLog | 7 +++++++
  9. tools/tiff2pdf.c | 7 ++++++-
  10. 2 files changed, 13 insertions(+), 1 deletion(-)
  11. diff --git a/ChangeLog b/ChangeLog
  12. index b4771234..1b5490f3 100644
  13. --- a/ChangeLog
  14. +++ b/ChangeLog
  15. @@ -1,3 +1,10 @@
  16. +2017-07-15 Even Rouault <even.rouault at spatialys.com>
  17. +
  18. + * tools/tiff2pdf.c: prevent heap buffer overflow write in "Raw"
  19. + mode on PlanarConfig=Contig input images.
  20. + Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2715
  21. + Reported by team OWL337
  22. +
  23. 2017-07-11 Even Rouault <even.rouault at spatialys.com>
  24. * libtiff/tif_lzw.c: fix 4.0.8 regression in the decoding of old-style LZW
  25. diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
  26. index db196e04..cd1e2358 100644
  27. --- a/tools/tiff2pdf.c
  28. +++ b/tools/tiff2pdf.c
  29. @@ -1737,7 +1737,12 @@ void t2p_read_tiff_data(T2P* t2p, TIFF* input){
  30. return;
  31. t2p->pdf_transcode = T2P_TRANSCODE_ENCODE;
  32. - if(t2p->pdf_nopassthrough==0){
  33. + /* It seems that T2P_TRANSCODE_RAW mode doesn't support separate->contig */
  34. + /* conversion. At least t2p_read_tiff_size and t2p_read_tiff_size_tile */
  35. + /* do not take into account the number of samples, and thus */
  36. + /* that can cause heap buffer overflows such as in */
  37. + /* http://bugzilla.maptools.org/show_bug.cgi?id=2715 */
  38. + if(t2p->pdf_nopassthrough==0 && t2p->tiff_planar!=PLANARCONFIG_SEPARATE){
  39. #ifdef CCITT_SUPPORT
  40. if(t2p->tiff_compression==COMPRESSION_CCITTFAX4
  41. ){