tif_write.c in libtiff 4.0.6 has an issue in the error code path of TIFFFlushData1() that didn't reset the tif_rawcc and tif_rawcp members. Reported as MSVR 35095, aka "TIFFFlushData1 heap-buffer-overflow."
https://euvd.enisa.europa.eu/vulnerability/EUVD-2016-10340
http://www.securityfocus.com/bid/94743
http://www.securityfocus.com/bid/94484