aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-09 13:23:10 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-28 13:39:26 +0200
commit898c51a01608ba30e21abbe16d9243ee264be660 (patch)
tree0024c14f6829fe7836d06a4af3943abc35e37137
parent7fe88bc66c8d1a03a1a64a2bf9984bc173b203f1 (diff)
downloadffmpeg-898c51a01608ba30e21abbe16d9243ee264be660.tar.gz
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> (cherry picked from commit f58cd2867a8af2eed13acdd21d067b48249b14a1) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/paf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/paf.c b/libavformat/paf.c
index 09786eb34f..09aefe6770 100644
--- a/libavformat/paf.c
+++ b/libavformat/paf.c
@@ -233,10 +233,11 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
p->current_frame_block++;
}
- size = p->video_size - p->frames_offset_table[p->current_frame];
- if (size < 1)
+ if (p->frames_offset_table[p->current_frame] >= p->video_size)
return AVERROR_INVALIDDATA;
+ size = p->video_size - p->frames_offset_table[p->current_frame];
+
if (av_new_packet(pkt, size) < 0)
return AVERROR(ENOMEM);