[vlc-commits] es_out: add array guards
Francois Cartegnie
git at videolan.org
Sun Dec 25 19:04:19 CET 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Dec 25 18:54:35 2016 +0100| [7cb36e8af8014f2b7e00934ea36581dda21f3312] | committer: Francois Cartegnie
es_out: add array guards
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7cb36e8af8014f2b7e00934ea36581dda21f3312
---
src/input/es_out.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 986f29c..a211e89 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3048,8 +3048,9 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
"ITU-R BT.2020",
"DCI/P3 D65",
};
- info_category_AddInfo( p_cat, _("Color primaries"), "%s",
- _(primaries_names[fmt->video.primaries]) );
+ if( fmt->video.primaries < ARRAY_SIZE(primaries_names) )
+ info_category_AddInfo( p_cat, _("Color primaries"), "%s",
+ _(primaries_names[fmt->video.primaries]) );
}
if( fmt->video.transfer != TRANSFER_FUNC_UNDEF )
{
@@ -3059,8 +3060,9 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
"ITU-R BT.709, ITU-R BT.2020",
"SMPTE ST2084",
};
- info_category_AddInfo( p_cat, _("Color transfer function"), "%s",
- _(func_names[fmt->video.transfer]) );
+ if( fmt->video.transfer < ARRAY_SIZE(func_names) )
+ info_category_AddInfo( p_cat, _("Color transfer function"), "%s",
+ _(func_names[fmt->video.transfer]) );
}
if( fmt->video.space != COLOR_SPACE_UNDEF )
{
@@ -3073,9 +3075,10 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
N_("Limited Range"),
N_("Full Range"),
};
- info_category_AddInfo( p_cat, _("Color space"), "%s %s",
- _(space_names[fmt->video.space]),
- _(range_names[fmt->video.b_color_range_full]) );
+ if( fmt->video.space < ARRAY_SIZE(space_names) )
+ info_category_AddInfo( p_cat, _("Color space"), "%s %s",
+ _(space_names[fmt->video.space]),
+ _(range_names[fmt->video.b_color_range_full]) );
}
if( fmt->video.chroma_location != CHROMA_LOCATION_UNDEF )
{
More information about the vlc-commits
mailing list