[Ffmpeg-devel] [PATCH] small bugfix in av_find_opt()
Kamil Nowosad
k.nowosad
Fri Mar 23 12:20:26 CET 2007
Hi,
While making some improvements in my tiff encoder i found a small 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.
example which caused that on my computer is:
ffmpeg -f image2 -vcodec tiff -i foo.tif -f image2 -vcodec png -coder ac
foo.png
and broke while parsing then "-coder ac" option
--
Best regards,
Kamil Nowosad
-------------- next part --------------
diff -upNr ffmpeg/libavcodec/opt.c ffmpeg-bugfix/libavcodec/opt.c
--- ffmpeg/libavcodec/opt.c 2007-03-23 10:48:26.000000000 +0000
+++ ffmpeg-bugfix/libavcodec/opt.c 2007-03-23 11:05:01.000000000 +0000
@@ -36,7 +36,7 @@ const AVOption *av_find_opt(void *v, con
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;
More information about the ffmpeg-devel
mailing list