[FFmpeg-cvslog] h264: Check that the codec isn't null before accessing it

Martin Storsjö git at videolan.org
Wed Aug 29 18:09:24 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Aug 28 14:27:10 2012 +0300| [6f5b1a2ba4cc568b3b8ae11b7dfd4a70fb891680] | committer: Martin Storsjö

h264: Check that the codec isn't null before accessing it

This fixes crashes introduced by 2e8f3cbcda5, the codec can be null
when called from parsers.

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavcodec/h264.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index a191bc7..2c4f07d 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3876,7 +3876,8 @@ again:
 
                 if (avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
                     h->cur_chroma_format_idc   != h->sps.chroma_format_idc) {
-                    if (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU
+                    if (s->avctx->codec &&
+                        s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU
                         && (h->sps.bit_depth_luma != 8 ||
                             h->sps.chroma_format_idc > 1)) {
                         av_log(avctx, AV_LOG_ERROR,



More information about the ffmpeg-cvslog mailing list