File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,9 +159,7 @@ OIIO_NAMESPACE_3_1_BEGIN
159159// / obvious equivalent.
160160OIIO_API TypeDesc tiff_datatype_to_typedesc (TIFFDataType tifftype, size_t tiffcount=1 );
161161
162- inline TypeDesc tiff_datatype_to_typedesc (const TIFFDirEntry& dir) {
163- return tiff_datatype_to_typedesc (TIFFDataType (dir.tdir_type ), dir.tdir_count );
164- }
162+ OIIO_API TypeDesc tiff_datatype_to_typedesc (const TIFFDirEntry& dir);
165163
166164// / Return the data size (in bytes) of the TIFF type.
167165OIIO_API size_t tiff_data_size (TIFFDataType tifftype);
Original file line number Diff line number Diff line change @@ -178,6 +178,22 @@ tiff_data_size(const TIFFDirEntry& dir)
178178
179179
180180
181+ TypeDesc
182+ tiff_datatype_to_typedesc (const TIFFDirEntry& dir)
183+ {
184+ // Check for corrupt/invalid value
185+ #if defined(TIFF_VERSION_BIG)
186+ if (dir.tdir_type > TIFF_IFD8)
187+ #else
188+ if (dir.tdir_type > TIFF_IFD)
189+ #endif
190+ return TypeUnknown;
191+ return tiff_datatype_to_typedesc (TIFFDataType (dir.tdir_type ),
192+ dir.tdir_count );
193+ }
194+
195+
196+
181197TypeDesc
182198tiff_datatype_to_typedesc (TIFFDataType tifftype, size_t tiffcount)
183199{
@@ -208,6 +224,7 @@ tiff_datatype_to_typedesc(TIFFDataType tifftype, size_t tiffcount)
208224 case TIFF_SLONG8: return TypeDesc (TypeDesc::INT64, tiffcount);
209225 case TIFF_IFD8: return TypeUnknown;
210226#endif
227+ default : break ;
211228 }
212229 return TypeUnknown;
213230}
You can’t perform that action at this time.
0 commit comments