[FFmpeg-cvslog] matroskadec: check realloc in lzo encoding

Luca Barbato git at videolan.org
Thu Sep 20 04:44:42 CEST 2012


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Fri Sep 14 18:39:58 2012 +0200| [581281e242609a222233a2e5538b89dfb88fb18e] | committer: Luca Barbato

matroskadec: check realloc in lzo encoding

Make all the compression encodings behave the same way.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=581281e242609a222233a2e5538b89dfb88fb18e
---

 libavformat/matroskadec.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 95130fc..bb505c2 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -999,7 +999,11 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
     case MATROSKA_TRACK_ENCODING_COMP_LZO:
         do {
             olen = pkt_size *= 3;
-            pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING);
+            newpktdata = av_realloc(pkt_data, pkt_size + AV_LZO_OUTPUT_PADDING);
+            if (!newpktdata) {
+                goto failed;
+            }
+            pkt_data = newpktdata;
             result = av_lzo1x_decode(pkt_data, &olen, data, &isize);
         } while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000);
         if (result)



More information about the ffmpeg-cvslog mailing list