Commit 39a7a5b8 authored by Aaron Colwell's avatar Aaron Colwell Committed by Ronald S. Bultje

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: 's avatarRonald S. Bultje <rsbultje@gmail.com>
parent ac47e014
...@@ -491,6 +491,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt) ...@@ -491,6 +491,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
} }
fctx->prev_thread = p; fctx->prev_thread = p;
fctx->next_decoding++;
return 0; return 0;
} }
...@@ -513,8 +514,6 @@ int ff_thread_decode_frame(AVCodecContext *avctx, ...@@ -513,8 +514,6 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
err = submit_packet(p, avpkt); err = submit_packet(p, avpkt);
if (err) return err; if (err) return err;
fctx->next_decoding++;
/* /*
* If we're still receiving the initial packets, don't return a frame. * If we're still receiving the initial packets, don't return a frame.
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment