mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
tiff: check for failure in search_keyval()
Fixes null pointer dereference Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
478fc7f57b
commit
f28043d0a3
@ -139,7 +139,11 @@ static int cmp_id_key(const void *id, const void *k)
|
|||||||
|
|
||||||
static const char *search_keyval(const TiffGeoTagKeyName *keys, int n, int id)
|
static const char *search_keyval(const TiffGeoTagKeyName *keys, int n, int id)
|
||||||
{
|
{
|
||||||
return ((TiffGeoTagKeyName*)bsearch(&id, keys, n, sizeof(keys[0]), cmp_id_key))->name;
|
TiffGeoTagKeyName *r = bsearch(&id, keys, n, sizeof(keys[0]), cmp_id_key);
|
||||||
|
if(r)
|
||||||
|
return r->name;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *get_geokey_val(int key, int val)
|
static char *get_geokey_val(int key, int val)
|
||||||
@ -187,10 +191,12 @@ static char *get_geokey_val(int key, int val)
|
|||||||
RET_GEOKEY_VAL(PRIME_MERIDIAN, prime_meridian);
|
RET_GEOKEY_VAL(PRIME_MERIDIAN, prime_meridian);
|
||||||
break;
|
break;
|
||||||
case TIFF_PROJECTED_CS_TYPE_GEOKEY:
|
case TIFF_PROJECTED_CS_TYPE_GEOKEY:
|
||||||
return av_strdup(search_keyval(ff_tiff_proj_cs_type_codes, FF_ARRAY_ELEMS(ff_tiff_proj_cs_type_codes), val));
|
ap = av_strdup(search_keyval(ff_tiff_proj_cs_type_codes, FF_ARRAY_ELEMS(ff_tiff_proj_cs_type_codes), val));
|
||||||
|
if(ap) return ap;
|
||||||
break;
|
break;
|
||||||
case TIFF_PROJECTION_GEOKEY:
|
case TIFF_PROJECTION_GEOKEY:
|
||||||
return av_strdup(search_keyval(ff_tiff_projection_codes, FF_ARRAY_ELEMS(ff_tiff_projection_codes), val));
|
ap = av_strdup(search_keyval(ff_tiff_projection_codes, FF_ARRAY_ELEMS(ff_tiff_projection_codes), val));
|
||||||
|
if(ap) return ap;
|
||||||
break;
|
break;
|
||||||
case TIFF_PROJ_COORD_TRANS_GEOKEY:
|
case TIFF_PROJ_COORD_TRANS_GEOKEY:
|
||||||
RET_GEOKEY_VAL(COORD_TRANS, coord_trans);
|
RET_GEOKEY_VAL(COORD_TRANS, coord_trans);
|
||||||
|
Loading…
Reference in New Issue
Block a user