changeset 32221:4034fb538bc1

Fix decoded length calculation of LZO decompression in demux_mkv.
author reimar
date Sat, 18 Sep 2010 17:24:39 +0000
parents 2494181f252b
children bceb1da0fe8f
files libmpdemux/demux_mkv.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c	Sat Sep 18 17:18:22 2010 +0000
+++ b/libmpdemux/demux_mkv.c	Sat Sep 18 17:24:39 2010 +0000
@@ -344,6 +344,7 @@
 #endif
         if (track->encodings[i].comp_algo == 2) {
             /* lzo encoded track */
+            int out_avail;
             int dstlen = *size > SIZE_MAX/3 ? *size : *size * 3;
 
             *dest = NULL;
@@ -352,7 +353,8 @@
                 if (dstlen > SIZE_MAX - AV_LZO_OUTPUT_PADDING)
                     goto lzo_fail;
                 *dest = realloc(*dest, dstlen + AV_LZO_OUTPUT_PADDING);
-                result = av_lzo1x_decode(*dest, &dstlen, src, &srclen);
+                out_avail = dstlen;
+                result = av_lzo1x_decode(*dest, &out_avail, src, &srclen);
                 if (result == 0)
                     break;
                 if (!(result & AV_LZO_OUTPUT_FULL)) {
@@ -369,7 +371,7 @@
                     goto lzo_fail;
                 dstlen *= 2;
             }
-            *size = dstlen;
+            *size = dstlen - out_avail;
         }
     }