This repository was archived by the owner on Dec 1, 2017. It is now read-only.
File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 1+ 2016-12-03 Even Rouault <even.rouault at spatialys.com>
2+
3+ * libtiff/tif_ojpeg.c: make OJPEGDecode() early exit in case of failure in
4+ OJPEGPreDecode(). This will avoid a divide by zero, and potential other issues.
5+ Reported by Agostino Sarubbo.
6+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2611
7+
182016-12-03 Even Rouault <even.rouault at spatialys.com>
29
310 * libtiff/tif_dirread.c: modify ChopUpSingleUncompressedStrip() to
Original file line number Diff line number Diff line change @@ -244,6 +244,7 @@ typedef enum {
244244
245245typedef struct {
246246 TIFF * tif ;
247+ int decoder_ok ;
247248 #ifndef LIBJPEG_ENCAP_EXTERNAL
248249 JMP_BUF exit_jmpbuf ;
249250 #endif
@@ -722,6 +723,7 @@ OJPEGPreDecode(TIFF* tif, uint16 s)
722723 }
723724 sp -> write_curstrile ++ ;
724725 }
726+ sp -> decoder_ok = 1 ;
725727 return (1 );
726728}
727729
@@ -784,8 +786,14 @@ OJPEGPreDecodeSkipScanlines(TIFF* tif)
784786static int
785787OJPEGDecode (TIFF * tif , uint8 * buf , tmsize_t cc , uint16 s )
786788{
789+ static const char module []= "OJPEGDecode" ;
787790 OJPEGState * sp = (OJPEGState * )tif -> tif_data ;
788791 (void )s ;
792+ if ( !sp -> decoder_ok )
793+ {
794+ TIFFErrorExt (tif -> tif_clientdata ,module ,"Cannot decode: decoder not correctly initialized" );
795+ return 0 ;
796+ }
789797 if (sp -> libjpeg_jpeg_query_style == 0 )
790798 {
791799 if (OJPEGDecodeRaw (tif ,buf ,cc )== 0 )
You can’t perform that action at this time.
0 commit comments