summaryrefslogtreecommitdiffstats
path: root/av_log.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-08-15 02:58:51 +0300
committerUoti Urpala <uau@mplayer2.org>2011-08-15 02:58:51 +0300
commit54d0763b92f3d8239aa2258f2193eebdc74a91ef (patch)
tree35fe0ba651c7b37549fd5b085f0c676aa78f1698 /av_log.c
parent9e6933440ae59c523fce85b64d6f52f444910003 (diff)
downloadmpv-54d0763b92f3d8239aa2258f2193eebdc74a91ef.tar.bz2
mpv-54d0763b92f3d8239aa2258f2193eebdc74a91ef.tar.xz
av_log: don't crash if called with NULL AVClass
At least libavformat mpegts demuxer may give bad parameters with NULL AVClass to the av_log callback. Check for this and print a warning instead of crashing.
Diffstat (limited to 'av_log.c')
-rw-r--r--av_log.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/av_log.c b/av_log.c
index 376144800a..d4684218ed 100644
--- a/av_log.c
+++ b/av_log.c
@@ -54,6 +54,12 @@ static int extract_msg_type_from_ctx(void *ptr)
return MSGT_FIXME;
AVClass *avc = *(AVClass **)ptr;
+ if (!avc) {
+ mp_msg(MSGT_FIXME, MSGL_WARN,
+ "av_log callback called with bad parameters (NULL AVClass).\n"
+ "This is a bug in one of Libav/FFmpeg libraries used.\n");
+ return MSGT_FIXME;
+ }
#ifdef CONFIG_FFMPEG
if (!strcmp(avc->class_name, "AVCodecContext")) {
@@ -71,9 +77,7 @@ static int extract_msg_type_from_ctx(void *ptr)
}
return MSGT_FIXME;
}
-#endif
-#ifdef CONFIG_FFMPEG
if (!strcmp(avc->class_name, "AVFormatContext")) {
AVFormatContext *s = ptr;
if (s->iformat)