mirror of https://github.com/mpv-player/mpv
demux_mkv: fix decoded length calculation of LZO decompression
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32305 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
7aa202d9a7
commit
044fc491fa
|
@ -368,6 +368,7 @@ static void demux_mkv_decode(mkv_track_t *track, uint8_t *src,
|
||||||
#endif
|
#endif
|
||||||
} else if (enc->comp_algo == 2) {
|
} else if (enc->comp_algo == 2) {
|
||||||
/* lzo encoded track */
|
/* lzo encoded track */
|
||||||
|
int out_avail;
|
||||||
int dstlen = *size * 3;
|
int dstlen = *size * 3;
|
||||||
|
|
||||||
*dest = NULL;
|
*dest = NULL;
|
||||||
|
@ -375,7 +376,8 @@ static void demux_mkv_decode(mkv_track_t *track, uint8_t *src,
|
||||||
int srclen = *size;
|
int srclen = *size;
|
||||||
*dest = talloc_realloc_size(NULL, *dest,
|
*dest = talloc_realloc_size(NULL, *dest,
|
||||||
dstlen + AV_LZO_OUTPUT_PADDING);
|
dstlen + AV_LZO_OUTPUT_PADDING);
|
||||||
int result = av_lzo1x_decode(*dest, &dstlen, src, &srclen);
|
out_avail = dstlen;
|
||||||
|
int result = av_lzo1x_decode(*dest, &out_avail, src, &srclen);
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
break;
|
break;
|
||||||
if (!(result & AV_LZO_OUTPUT_FULL)) {
|
if (!(result & AV_LZO_OUTPUT_FULL)) {
|
||||||
|
@ -389,7 +391,7 @@ static void demux_mkv_decode(mkv_track_t *track, uint8_t *src,
|
||||||
"[mkv] lzo decompression buffer too small.\n");
|
"[mkv] lzo decompression buffer too small.\n");
|
||||||
dstlen *= 2;
|
dstlen *= 2;
|
||||||
}
|
}
|
||||||
*size = dstlen;
|
*size = dstlen - out_avail;
|
||||||
} else if (enc->comp_algo == 3) {
|
} else if (enc->comp_algo == 3) {
|
||||||
*dest = talloc_size(NULL, *size + enc->comp_settings_len);
|
*dest = talloc_size(NULL, *size + enc->comp_settings_len);
|
||||||
memcpy(*dest, enc->comp_settings, enc->comp_settings_len);
|
memcpy(*dest, enc->comp_settings, enc->comp_settings_len);
|
||||||
|
|
Loading…
Reference in New Issue