[FFmpeg-devel] [PATCH 2/2] dv: dont crash in dv_frame_offset if avpriv_dv_codec_profile returns NULL
Marton Balint
cus at passwd.hu
Tue Dec 27 18:33:10 CET 2011
On Mon, 26 Dec 2011, Michael Niedermayer wrote:
> On Sun, Dec 25, 2011 at 07:31:24PM +0100, Marton Balint wrote:
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>> libavformat/dv.c | 6 +++++-
>> 1 files changed, 5 insertions(+), 1 deletions(-)
>>
>> diff --git a/libavformat/dv.c b/libavformat/dv.c
>> index 5dddaf6..b4d874c 100644
>> --- a/libavformat/dv.c
>> +++ b/libavformat/dv.c
>> @@ -34,6 +34,7 @@
>> #include "libavcodec/dvdata.h"
>> #include "libavutil/intreadwrite.h"
>> #include "libavutil/mathematics.h"
>> +#include "libavutil/avassert.h"
>> #include "dv.h"
>>
>> struct DVDemuxContext {
>> @@ -373,7 +374,10 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
>> const DVprofile* sys = avpriv_dv_codec_profile(c->vst->codec);
>> int64_t offset;
>> int64_t size = avio_size(s->pb) - s->data_offset;
>> - int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
>> + int64_t max_offset;
>> +
>> + av_assert0(sys);
>> + max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
>
> i think this should return with an error unless its (supposed to be)
> impossible for user input to ffmpeg/ffplay to trigger it
Well, I assumed that since we are dereferencing sys unconditionally at the
moment, it should not be NULL under normal circumstances. I am not sure if
that is really the case or not. Somebody more familar with the dv code may
comment on this one.
Regards,
Marton
More information about the ffmpeg-devel
mailing list