[FFmpeg-cvslog] ffmpeg: fix negative array index

Michael Niedermayer git at videolan.org
Mon Oct 22 14:08:50 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Oct 22 13:58:19 2012 +0200| [c3778df2d4c05e76d28d77a2d740e435393046c9] | committer: Michael Niedermayer

ffmpeg: fix negative array index

Fixes CID733808
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c3778df2d4c05e76d28d77a2d740e435393046c9
---

 ffmpeg_filter.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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) {



More information about the ffmpeg-cvslog mailing list