Commit 9054f6b6 authored by Michael Niedermayer's avatar Michael Niedermayer

probe_codec: fix memory corruption

Found-by: Tanami Ohad
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 6bf87785
......@@ -680,11 +680,15 @@ static void probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
--st->probe_packets;
if (pkt) {
pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE);
uint8_t *new_buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE);
if(!new_buf)
goto no_packet;
pd->buf = new_buf;
memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);
pd->buf_size += pkt->size;
memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
} else {
no_packet:
st->probe_packets = 0;
}
......
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