From a4072c453b23a24afd276f17fe1876df11ab1e0d Mon Sep 17 00:00:00 2001 From: Kamil Nowosad Date: Fri, 30 Mar 2007 09:26:13 +0000 Subject: [PATCH] Fix a bug in av_find_opt(). Because some of the AVOption structures have field unit = NULL, the function could pass NULL to strcmp and cause a segfault. Patch by Kamil Nowosad, k nowosad % students mimuw edu pl. Original thread: Subject: [PATCH] small bugfix in av_find_opt() Date: 03/23/2007 12:20 PM Originally committed as revision 8553 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/opt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/opt.c b/libavcodec/opt.c index cfff0c19d9..97b593cb2f 100644 --- a/libavcodec/opt.c +++ b/libavcodec/opt.c @@ -36,7 +36,7 @@ const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mas const AVOption *o= c->option; for(;o && o->name; o++){ - if(!strcmp(o->name, name) && (!unit || !strcmp(o->unit, unit)) && (o->flags & mask) == flags ) + if(!strcmp(o->name, name) && (!unit || (o->unit && !strcmp(o->unit, unit))) && (o->flags & mask) == flags ) return o; } return NULL;