Fixes CVE-2017-7594 (Direct leak in tif_ojpeg.c): http://bugzilla.maptools.org/show_bug.cgi?id=2659 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7594 https://security-tracker.debian.org/tracker/CVE-2017-7594 2017-01-12 Even Rouault * libtiff/tif_ojpeg.c: fix leak in OJPEGReadHeaderInfoSecTablesAcTable when read fails. Patch by Nicolás Peña. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2659 /cvs/maptools/cvsroot/libtiff/ChangeLog,v <-- ChangeLog new revision: 1.1212; previous revision: 1.1211 /cvs/maptools/cvsroot/libtiff/libtiff/tif_ojpeg.c,v <-- libtiff/tif_ojpeg.c new revision: 1.67; previous revision: 1.66 Index: libtiff/libtiff/tif_ojpeg.c =================================================================== RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_ojpeg.c,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- libtiff/libtiff/tif_ojpeg.c 12 Jan 2017 17:43:26 -0000 1.67 +++ libtiff/libtiff/tif_ojpeg.c 12 Jan 2017 19:23:20 -0000 1.68 @@ -1,4 +1,4 @@ -/* $Id: tif_ojpeg.c,v 1.66 2016-12-03 11:15:18 erouault Exp $ */ +/* $Id: tif_ojpeg.c,v 1.68 2017-01-12 19:23:20 erouault Exp $ */ /* WARNING: The type of JPEG encapsulation defined by the TIFF Version 6.0 specification is now totally obsolete and deprecated for new applications and @@ -1790,7 +1790,10 @@ TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET); p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64); if (p!=64) + { + _TIFFfree(ob); return(0); + } sp->qtable[m]=ob; sp->sof_tq[m]=m; } @@ -1854,7 +1857,10 @@ rb[sizeof(uint32)+5+n]=o[n]; p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q); if (p!=q) + { + _TIFFfree(rb); return(0); + } sp->dctable[m]=rb; sp->sos_tda[m]=(m<<4); }