Commit 841c0aaf authored by Hendrik Leppkes's avatar Hendrik Leppkes Committed by Michael Niedermayer

avcodec/pthread: check packet buffer allocation

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent eff2edae
......@@ -343,6 +343,10 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
p->avpkt.buf = av_buffer_ref(avpkt->buf);
else {
av_fast_malloc(&p->buf, &p->allocated_buf_size, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!p->buf) {
pthread_mutex_unlock(&p->mutex);
return AVERROR(ENOMEM);
}
p->avpkt.data = p->buf;
memcpy(p->buf, avpkt->data, avpkt->size);
memset(p->buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
......
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