From d872fb0f7ff2ff0ba87f5ccf6a1a55ca2be472c9 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Thu, 26 Sep 2013 16:37:02 +0300 Subject: lavf: Reset the entry count and allocation size variables on av_reallocp failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When av_reallocp fails, the associated variables that keep track of the number of elements in the array (and in some cases, the separate number of allocated elements) need to be reset. Not all of these might technically be needed, but it's better to reset them if in doubt, to make sure variables don't end up conflicting. Signed-off-by: Martin Storsjö --- libavformat/oggparsetheora.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libavformat/oggparsetheora.c') diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index 94e9eba35c..25210ab450 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -124,8 +124,10 @@ theora_header (AVFormatContext * s, int idx) } if ((err = av_reallocp(&st->codec->extradata, - cds + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) + cds + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { + st->codec->extradata_size = 0; return err; + } cdp = st->codec->extradata + st->codec->extradata_size; *cdp++ = os->psize >> 8; *cdp++ = os->psize & 0xff; -- cgit v1.2.3