summaryrefslogtreecommitdiff
path: root/libavcodec/flac_parser.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-09-22 04:40:10 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-09-22 04:40:10 +0200
commit8d45c001a8e92a6fee768a7e7bcc1bfe09120838 (patch)
tree988e79f6050afb8fc1bee08bbc402303918a72e4 /libavcodec/flac_parser.c
parent1b1b902e2ce19e0276bf847cc87384ec43d230e3 (diff)
flac_parser: fix fifo ptr wrap check
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/flac_parser.c')
-rw-r--r--libavcodec/flac_parser.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 17b96e2c6b..e37ca64be8 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -606,10 +606,11 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
/* restore the state pre-padding */
if (fpc->end_padded) {
+ int warp = fpc->fifo_buf->wptr - fpc->fifo_buf->buffer < MAX_FRAME_HEADER_SIZE;
/* HACK: drain the tail of the fifo */
fpc->fifo_buf->wptr -= MAX_FRAME_HEADER_SIZE;
fpc->fifo_buf->wndx -= MAX_FRAME_HEADER_SIZE;
- if (fpc->fifo_buf->wptr < 0) {
+ if (warp) {
fpc->fifo_buf->wptr += fpc->fifo_buf->end -
fpc->fifo_buf->buffer;
}