comparison opt.c @ 4748:c6a2b573f259 libavcodec

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
author takis
date Fri, 30 Mar 2007 09:26:13 +0000
parents 66aff3b71861
children 2b72f9bc4f06
comparison
equal deleted inserted replaced
4747:66aff3b71861 4748:c6a2b573f259
34 const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags){ 34 const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags){
35 AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass 35 AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass
36 const AVOption *o= c->option; 36 const AVOption *o= c->option;
37 37
38 for(;o && o->name; o++){ 38 for(;o && o->name; o++){
39 if(!strcmp(o->name, name) && (!unit || !strcmp(o->unit, unit)) && (o->flags & mask) == flags ) 39 if(!strcmp(o->name, name) && (!unit || (o->unit && !strcmp(o->unit, unit))) && (o->flags & mask) == flags )
40 return o; 40 return o;
41 } 41 }
42 return NULL; 42 return NULL;
43 } 43 }
44 44