Skip to content

Commit

Permalink
ape: stop reading after the last frame has been read
Browse files Browse the repository at this point in the history
This avoids buffer overread when the last packet size estimate is too small.
  • Loading branch information
justinruggles committed Feb 6, 2012
1 parent 66f7be3 commit c2c3161
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libavformat/ape.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)

if (s->pb->eof_reached)
return AVERROR_EOF;
if (ape->currentframe > ape->totalframes)
if (ape->currentframe >= ape->totalframes)
return AVERROR_EOF;

if (avio_seek(s->pb, ape->frames[ape->currentframe].pos, SEEK_SET) < 0)
Expand Down

0 comments on commit c2c3161

Please sign in to comment.