Skip to content
Snippets Groups Projects
Commit 7ec1d9a4 authored by Su Laus's avatar Su Laus
Browse files

Check input parameters in _TIFFMergeFields()

Fixes #624
parent 3dff9205
No related branches found
No related tags found
1 merge request!559Fix 624: Check input parameters in _TIFFMergeFields()
......@@ -574,9 +574,20 @@ int _TIFFMergeFields(TIFF *tif, const TIFFField info[], uint32_t n)
{
static const char module[] = "_TIFFMergeFields";
static const char reason[] = "for fields array";
/* TIFFField** tp; */
uint32_t i;
/* Check input */
if (tif == NULL || info == NULL)
{
TIFFWarningExtR(tif, module, "An input pointer is NULL");
return 0;
}
else if (n == 0)
{
TIFFWarningExtR(tif, module, "Number of fields to be merged is zero");
return 0;
}
tif->tif_foundfield = NULL;
if (tif->tif_fields && tif->tif_nfields > 0)
......@@ -596,7 +607,6 @@ int _TIFFMergeFields(TIFF *tif, const TIFFField info[], uint32_t n)
return 0;
}
/* tp = tif->tif_fields + tif->tif_nfields; */
for (i = 0; i < n; i++)
{
const TIFFField *fip = TIFFFindField(tif, info[i].field_tag, TIFF_ANY);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment