[FFmpeg-devel] [PATCH] lavu/opt: handle NULL during class comparsion
Lukasz Marek
lukasz.m.luki2 at gmail.com
Wed Dec 3 00:06:18 CET 2014
av_opt_copy compares classes to avoid copying between mismatched objects.
This protection fails when dest class is NULL.
Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
---
libavutil/opt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index d873bd2..0e42ff6 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1576,14 +1576,15 @@ static int opt_size(enum AVOptionType type)
int av_opt_copy(void *dst, FF_CONST_AVUTIL55 void *src)
{
const AVOption *o = NULL;
- const AVClass *c;
+ const AVClass *c, *d;
int ret = 0;
if (!src)
return 0;
c = *(AVClass**)src;
- if (*(AVClass**)dst && c != *(AVClass**)dst)
+ d = *(AVClass**)dst;
+ if (!d || (d && c != d))
return AVERROR(EINVAL);
while ((o = av_opt_next(src, o))) {
--
1.9.1
More information about the ffmpeg-devel
mailing list