[FFmpeg-devel] [PATCH] robustify parsing of flv metadata
Pascal Massimino
pascal.massimino
Tue Mar 18 22:33:24 CET 2008
Gents,
a little patch to prevent non-sense num_val in broken
metadata packets. Maybe it's better to bail out in such
cases, dunno for sure.
skal
--- ffmpeg/libavformat/flvdec.c 2008-03-18 13:51:08.000000000 -0700
+++ ffmpeg/libavformat/flvdec.c 2008-03-18 13:53:09.000000000 -0700
@@ -169,9 +169,11 @@
if(!strcmp(key, "duration")) s->duration = num_val *
AV_TIME_BASE;
// else if(!strcmp(key, "width") && vcodec && num_val > 0)
vcodec->width = num_val;
// else if(!strcmp(key, "height") && vcodec && num_val > 0)
vcodec->height = num_val;
- else if(!strcmp(key, "audiocodecid") && acodec)
flv_set_audio_codec(s, astream, (int)num_val << FLV_AUDIO_CODECID_OFFSET);
- else if(!strcmp(key, "videocodecid") && vcodec)
flv_set_video_codec(s, vstream, (int)num_val);
- else if(!strcmp(key, "audiosamplesize") && acodec && num_val >=
0) {
+ else if(!strcmp(key, "audiocodecid") && acodec && num_val >=0)
+ flv_set_audio_codec(s, astream, (int)num_val <<
FLV_AUDIO_CODECID_OFFSET);
+ else if(!strcmp(key, "videocodecid") && vcodec && num_val >=0)
+ flv_set_video_codec(s, vstream, (int)num_val);
+ else if(!strcmp(key, "audiosamplesize") && acodec && num_val >
0) {
acodec->bits_per_sample = num_val;
//we may have to rewrite a previously read codecid because
FLV only marks PCM endianness.
if(num_val == 8 && (acodec->codec_id == CODEC_ID_PCM_S16BE
|| acodec->codec_id == CODEC_ID_PCM_S16LE))
More information about the ffmpeg-devel
mailing list