summaryrefslogtreecommitdiff
path: root/libavcodec/pthread.c
diff options
context:
space:
mode:
authorAaron Colwell <acolwell@chromium.org>2011-11-28 07:23:03 -0800
committerRonald S. Bultje <rsbultje@gmail.com>2011-11-28 20:30:30 -0800
commit39a7a5b8ab12bc75306f52e671dfb1497771553b (patch)
tree001a19a4fc402da2246e81815bb2df0c42c397b9 /libavcodec/pthread.c
parentac47e014bbaf5163871a8beb7522015e0bc27615 (diff)
downloadffmpeg-39a7a5b8ab12bc75306f52e671dfb1497771553b.tar.gz
pthread: don't increment index on zero-sized packets.
The next call to decode() will update from an invalid index, which will either lead to a memcpy() where dest==src (2 threads), or lead to a crash (>2 threads). Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r--libavcodec/pthread.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 21e32b59ea..1364f5722d 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -491,6 +491,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
}
fctx->prev_thread = p;
+ fctx->next_decoding++;
return 0;
}
@@ -513,8 +514,6 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
err = submit_packet(p, avpkt);
if (err) return err;
- fctx->next_decoding++;
-
/*
* If we're still receiving the initial packets, don't return a frame.
*/