summaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-26 01:05:01 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-26 01:10:55 +0200
commit9054f6b66b3883d615177c738cb69c6337c4375c (patch)
tree8ad4e0b069fb91f3cb8182fb6fbb0493bf12e234 /libavformat
parent6bf87785e8e92da4d2223741a3d7d13428cbae8b (diff)
downloadffmpeg-streaming-9054f6b66b3883d615177c738cb69c6337c4375c.zip
ffmpeg-streaming-9054f6b66b3883d615177c738cb69c6337c4375c.tar.gz
probe_codec: fix memory corruption
Found-by: Tanami Ohad Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index caa8c4b..fa3b962 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -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;
}
OpenPOWER on IntegriCloud