summaryrefslogtreecommitdiff
authorMichael Niedermayer <michaelni@gmx.at>2012-10-22 11:58:19 (GMT)
committer Michael Niedermayer <michaelni@gmx.at>2012-10-22 11:58:19 (GMT)
commitc3778df2d4c05e76d28d77a2d740e435393046c9 (patch)
treecc90044fb53cd2ff0e32733e47533cc2c45b156c
parent6182e0a6f64023abee31e64177b3c96488455541 (diff)
downloadffmpeg-c3778df2d4c05e76d28d77a2d740e435393046c9.zip
ffmpeg-c3778df2d4c05e76d28d77a2d740e435393046c9.tar.gz
ffmpeg-c3778df2d4c05e76d28d77a2d740e435393046c9.tar.bz2
ffmpeg: fix negative array index
Fixes CID733808 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat
-rw-r--r--ffmpeg_filter.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index b634ac5..6a51410 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -37,7 +37,8 @@ enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFo
{
if (codec && codec->pix_fmts) {
const enum AVPixelFormat *p = codec->pix_fmts;
- int has_alpha= av_pix_fmt_desc_get(target)->nb_components % 2 == 0;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(target);
+ int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
enum AVPixelFormat best= AV_PIX_FMT_NONE;
if (st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
if (st->codec->codec_id == AV_CODEC_ID_MJPEG) {