summaryrefslogtreecommitdiff
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-09-29 01:03:02 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-29 01:11:01 +0200
commitf9a2d0c3feccab94a86c92396f3e36110dc2227b (patch)
treee7d0fa58e78006fd1d26dab64c74f22355bd9ce8 /libavformat/matroskadec.c
parenta3a5c61c6175a0bf398cce6a51fe94fcfca1145b (diff)
parentdaf98908118074e96199ca7195663af4543d3808 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (23 commits) avconv: Reformat s16 volume adjustment. ARM: NEON optimised vector_fmac_scalar() dca: use vector_fmac_scalar from dsputil dsputil: add vector_fmac_scalar() latmenc: Fix private options vf_unsharp: store hsub/vsub in the filter context vf_unsharp: adopt a more natural order of params in apply_unsharp() vf_unsharp: rename method "unsharpen" to "apply_unsharp" vf_scale: apply the same transform to the aspect during init that is applied per frame vf_pad: fix "vsub" variable value computation vf_scale: add a "sar" variable lavfi: fix realloc size computation in avfilter_add_format() vsrc_color: use internal timebase lavfi: fix signature for avfilter_graph_parse() and avfilter_graph_config() graphparser: prefer void * over AVClass * for log contexts avfiltergraph: use meaningful error codes avconv: Initialize return value for codec copy path. fate: use 'run' helper for seek-test fate: remove seek-mpeg2reuse test Fix memory (re)allocation in matroskadec.c, related to MSVR-11-0080. ... Conflicts: doc/filters.texi libavfilter/avfilter.h libavfilter/avfiltergraph.c libavfilter/avfiltergraph.h libavfilter/graphparser.c libavfilter/vf_scale.c libavfilter/vsrc_color.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index c05a0b5653..dccf589177 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -967,6 +967,7 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
uint8_t* data = *buf;
int isize = *buf_size;
uint8_t* pkt_data = NULL;
+ uint8_t* newpktdata;
int pkt_size = isize;
int result = 0;
int olen;
@@ -996,7 +997,12 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
zstream.avail_in = isize;
do {
pkt_size *= 3;
- pkt_data = av_realloc(pkt_data, pkt_size);
+ newpktdata = av_realloc(pkt_data, pkt_size);
+ if (!newpktdata) {
+ inflateEnd(&zstream);
+ goto failed;
+ }
+ pkt_data = newpktdata;
zstream.avail_out = pkt_size - zstream.total_out;
zstream.next_out = pkt_data + zstream.total_out;
if (pkt_data) {
@@ -1020,7 +1026,12 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
bzstream.avail_in = isize;
do {
pkt_size *= 3;
- pkt_data = av_realloc(pkt_data, pkt_size);
+ newpktdata = av_realloc(pkt_data, pkt_size);
+ if (!newpktdata) {
+ BZ2_bzDecompressEnd(&bzstream);
+ goto failed;
+ }
+ pkt_data = newpktdata;
bzstream.avail_out = pkt_size - bzstream.total_out_lo32;
bzstream.next_out = pkt_data + bzstream.total_out_lo32;
if (pkt_data) {