external libs / tiff: applied a bug fix from mainstream git and rebuilt
authorOzkan Sezer <sezeroz@gmail.com>
Wed, 13 Nov 2019 18:50:00 +0300
changeset 744c79c2855603a
parent 740 1671405f6357
child 745 19cb0b753d82
external libs / tiff: applied a bug fix from mainstream git and rebuilt
VisualC/external/lib/x64/libtiff-5.dll
VisualC/external/lib/x86/libtiff-5.dll
external/tiff-4.1.0/0001-libtiff.git-0356ea76.patch
external/tiff-4.1.0/libtiff/tif_ojpeg.c
     1.1 Binary file VisualC/external/lib/x64/libtiff-5.dll has changed
     2.1 Binary file VisualC/external/lib/x86/libtiff-5.dll has changed
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/external/tiff-4.1.0/0001-libtiff.git-0356ea76.patch	Wed Nov 13 18:50:00 2019 +0300
     3.3 @@ -0,0 +1,79 @@
     3.4 +From 0356ea76bac908c61160d735f078437ace953bd3 Mon Sep 17 00:00:00 2001
     3.5 +From: Even Rouault <even.rouault@spatialys.com>
     3.6 +Date: Mon, 11 Nov 2019 23:02:08 +0100
     3.7 +Subject: [PATCH] OJPEG: fix broken sanity check added in 4.1.0 (#fixes 172)
     3.8 +
     3.9 +diff --git a/libtiff/tif_ojpeg.c b/libtiff/tif_ojpeg.c
    3.10 +index bf0d1a2a..d6f7d97e 100644
    3.11 +--- a/libtiff/tif_ojpeg.c
    3.12 ++++ b/libtiff/tif_ojpeg.c
    3.13 +@@ -837,36 +837,6 @@ OJPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc)
    3.14 + 	{
    3.15 + 		if (sp->subsampling_convert_state==0)
    3.16 + 		{
    3.17 +-			const jpeg_decompress_struct* cinfo = &sp->libjpeg_jpeg_decompress_struct;
    3.18 +-			int width = 0;
    3.19 +-			int last_col_width = 0;
    3.20 +-			int jpeg_bytes;
    3.21 +-			int expected_bytes;
    3.22 +-			int i;
    3.23 +-			if (cinfo->MCUs_per_row == 0)
    3.24 +-			{
    3.25 +-				sp->error_in_raw_data_decoding = 1;
    3.26 +-				return 0;
    3.27 +-			}
    3.28 +-			for (i = 0; i < cinfo->comps_in_scan; ++i)
    3.29 +-			{
    3.30 +-				const jpeg_component_info* info = cinfo->cur_comp_info[i];
    3.31 +-#if JPEG_LIB_VERSION >= 70
    3.32 +-				width += info->MCU_width * info->DCT_h_scaled_size;
    3.33 +-				last_col_width += info->last_col_width * info->DCT_h_scaled_size;
    3.34 +-#else
    3.35 +-				width += info->MCU_width * info->DCT_scaled_size;
    3.36 +-				last_col_width += info->last_col_width * info->DCT_scaled_size;
    3.37 +-#endif
    3.38 +-			}
    3.39 +-			jpeg_bytes = (cinfo->MCUs_per_row - 1) * width + last_col_width;
    3.40 +-			expected_bytes = sp->subsampling_convert_clinelenout * sp->subsampling_ver * sp->subsampling_hor;
    3.41 +-			if (jpeg_bytes != expected_bytes)
    3.42 +-			{
    3.43 +-				TIFFErrorExt(tif->tif_clientdata,module,"Inconsistent number of MCU in codestream");
    3.44 +-				sp->error_in_raw_data_decoding = 1;
    3.45 +-				return(0);
    3.46 +-			}
    3.47 + 			if (jpeg_read_raw_data_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),sp->subsampling_convert_ycbcrimage,sp->subsampling_ver*8)==0)
    3.48 + 			{
    3.49 + 				sp->error_in_raw_data_decoding = 1;
    3.50 +@@ -1291,6 +1261,29 @@ OJPEGWriteHeaderInfo(TIFF* tif)
    3.51 + 	}
    3.52 + 	if (jpeg_start_decompress_encap(sp,&(sp->libjpeg_jpeg_decompress_struct))==0)
    3.53 + 		return(0);
    3.54 ++        if(sp->libjpeg_jpeg_decompress_struct.image_width != sp->strile_width ||
    3.55 ++           sp->libjpeg_jpeg_decompress_struct.image_height < sp->strile_length) {
    3.56 ++            TIFFErrorExt(tif->tif_clientdata,module,
    3.57 ++                         "jpeg_start_decompress() returned image_width = %d "
    3.58 ++                         "and image_height = %d, expected %d and %d",
    3.59 ++                         sp->libjpeg_jpeg_decompress_struct.image_width,
    3.60 ++                         sp->libjpeg_jpeg_decompress_struct.image_height,
    3.61 ++                         sp->strile_width,
    3.62 ++                         sp->strile_length);
    3.63 ++            return 0;
    3.64 ++        }
    3.65 ++        if(sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor != sp->subsampling_hor ||
    3.66 ++           sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor != sp->subsampling_ver) {
    3.67 ++            TIFFErrorExt(tif->tif_clientdata,module,
    3.68 ++                         "jpeg_start_decompress() returned max_h_samp_factor = %d "
    3.69 ++                         "and max_v_samp_factor = %d, expected %d and %d",
    3.70 ++                         sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor,
    3.71 ++                         sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor,
    3.72 ++                         sp->subsampling_hor,
    3.73 ++                         sp->subsampling_ver);
    3.74 ++            return 0;
    3.75 ++        }
    3.76 ++
    3.77 + 	sp->writeheader_done=1;
    3.78 + 	return(1);
    3.79 + }
    3.80 +-- 
    3.81 +2.14.5
    3.82 +
     4.1 --- a/external/tiff-4.1.0/libtiff/tif_ojpeg.c	Sat Nov 09 11:37:02 2019 +0300
     4.2 +++ b/external/tiff-4.1.0/libtiff/tif_ojpeg.c	Wed Nov 13 18:50:00 2019 +0300
     4.3 @@ -837,36 +837,6 @@
     4.4  	{
     4.5  		if (sp->subsampling_convert_state==0)
     4.6  		{
     4.7 -			const jpeg_decompress_struct* cinfo = &sp->libjpeg_jpeg_decompress_struct;
     4.8 -			int width = 0;
     4.9 -			int last_col_width = 0;
    4.10 -			int jpeg_bytes;
    4.11 -			int expected_bytes;
    4.12 -			int i;
    4.13 -			if (cinfo->MCUs_per_row == 0)
    4.14 -			{
    4.15 -				sp->error_in_raw_data_decoding = 1;
    4.16 -				return 0;
    4.17 -			}
    4.18 -			for (i = 0; i < cinfo->comps_in_scan; ++i)
    4.19 -			{
    4.20 -				const jpeg_component_info* info = cinfo->cur_comp_info[i];
    4.21 -#if JPEG_LIB_VERSION >= 70
    4.22 -				width += info->MCU_width * info->DCT_h_scaled_size;
    4.23 -				last_col_width += info->last_col_width * info->DCT_h_scaled_size;
    4.24 -#else
    4.25 -				width += info->MCU_width * info->DCT_scaled_size;
    4.26 -				last_col_width += info->last_col_width * info->DCT_scaled_size;
    4.27 -#endif
    4.28 -			}
    4.29 -			jpeg_bytes = (cinfo->MCUs_per_row - 1) * width + last_col_width;
    4.30 -			expected_bytes = sp->subsampling_convert_clinelenout * sp->subsampling_ver * sp->subsampling_hor;
    4.31 -			if (jpeg_bytes != expected_bytes)
    4.32 -			{
    4.33 -				TIFFErrorExt(tif->tif_clientdata,module,"Inconsistent number of MCU in codestream");
    4.34 -				sp->error_in_raw_data_decoding = 1;
    4.35 -				return(0);
    4.36 -			}
    4.37  			if (jpeg_read_raw_data_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),sp->subsampling_convert_ycbcrimage,sp->subsampling_ver*8)==0)
    4.38  			{
    4.39  				sp->error_in_raw_data_decoding = 1;
    4.40 @@ -1291,6 +1261,29 @@
    4.41  	}
    4.42  	if (jpeg_start_decompress_encap(sp,&(sp->libjpeg_jpeg_decompress_struct))==0)
    4.43  		return(0);
    4.44 +        if(sp->libjpeg_jpeg_decompress_struct.image_width != sp->strile_width ||
    4.45 +           sp->libjpeg_jpeg_decompress_struct.image_height < sp->strile_length) {
    4.46 +            TIFFErrorExt(tif->tif_clientdata,module,
    4.47 +                         "jpeg_start_decompress() returned image_width = %d "
    4.48 +                         "and image_height = %d, expected %d and %d",
    4.49 +                         sp->libjpeg_jpeg_decompress_struct.image_width,
    4.50 +                         sp->libjpeg_jpeg_decompress_struct.image_height,
    4.51 +                         sp->strile_width,
    4.52 +                         sp->strile_length);
    4.53 +            return 0;
    4.54 +        }
    4.55 +        if(sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor != sp->subsampling_hor ||
    4.56 +           sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor != sp->subsampling_ver) {
    4.57 +            TIFFErrorExt(tif->tif_clientdata,module,
    4.58 +                         "jpeg_start_decompress() returned max_h_samp_factor = %d "
    4.59 +                         "and max_v_samp_factor = %d, expected %d and %d",
    4.60 +                         sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor,
    4.61 +                         sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor,
    4.62 +                         sp->subsampling_hor,
    4.63 +                         sp->subsampling_ver);
    4.64 +            return 0;
    4.65 +        }
    4.66 +
    4.67  	sp->writeheader_done=1;
    4.68  	return(1);
    4.69  }