avformat/paf: Fix integer overflow and out of array read

Found-by:  Laurent Butti <laurentb@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/37/head
Michael Niedermayer 12 years ago
parent c9837613ed
commit f58cd2867a
  1. 5
      libavformat/paf.c

@ -233,10 +233,11 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
p->current_frame_block++; p->current_frame_block++;
} }
size = p->video_size - p->frames_offset_table[p->current_frame]; if (p->frames_offset_table[p->current_frame] >= p->video_size)
if (size < 1)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
size = p->video_size - p->frames_offset_table[p->current_frame];
if (av_new_packet(pkt, size) < 0) if (av_new_packet(pkt, size) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

Loading…
Cancel
Save