--------------------- PatchSet 2863 Date: 2014/12/21 22:58:29 Author: erouault Branch: HEAD Tag: (none) Log: * tools/tiff2bw.c: when Photometric=RGB, the utility only works if SamplesPerPixel = 3. Enforce that http://bugzilla.maptools.org/show_bug.cgi?id=2485 (CVE-2014-8127) Members: ChangeLog:1.967->1.968 tools/tiff2bw.c:1.16->1.17 Index: libtiff/tools/tiff2bw.c diff -u libtiff/tools/tiff2bw.c:1.16 libtiff/tools/tiff2bw.c:1.17 --- libtiff/tools/tiff2bw.c:1.16 Thu May 2 09:44:29 2013 +++ libtiff/tools/tiff2bw.c Sun Dec 21 15:58:30 2014 @@ -171,6 +171,11 @@ argv[optind], samplesperpixel); return (-1); } + if( photometric == PHOTOMETRIC_RGB && samplesperpixel != 3) { + fprintf(stderr, "%s: Bad samples/pixel %u for PHOTOMETRIC_RGB.\n", + argv[optind], samplesperpixel); + return (-1); + } TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample); if (bitspersample != 8) { fprintf(stderr,