[FFmpeg-cvslog] nuv: Pad the lzo outbuf
Luca Barbato
git at videolan.org
Mon Nov 4 18:56:36 CET 2013
ffmpeg | branch: release/0.10 | Luca Barbato <lu_zero at gentoo.org> | Mon Aug 12 11:34:06 2013 +0200| [36fc320747a768335ae4538a24a5739033b7eb74] | committer: Luca Barbato
nuv: Pad the lzo outbuf
And properly update the buf_size with the correct size.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
(cherry picked from commit 075dbc185521f193c98b896cd63be3ec2613df5d)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
Conflicts:
libavcodec/nuv.c
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=36fc320747a768335ae4538a24a5739033b7eb74
---
libavcodec/nuv.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index b4e21bf..459fd27 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -116,7 +116,8 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, int qualit
return 0;
avctx->width = c->width = width;
avctx->height = c->height = height;
- av_fast_malloc(&c->decomp_buf, &c->decomp_size, c->height * c->width * 3 / 2);
+ av_fast_malloc(&c->decomp_buf, &c->decomp_size, c->height * c->width * 3 / 2 +
+ FF_INPUT_BUFFER_PADDING_SIZE);
if (!c->decomp_buf) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
return 0;
@@ -176,13 +177,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
buf = &buf[12];
buf_size -= 12;
if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
- int outlen = c->decomp_size, inlen = buf_size;
+ int outlen = c->decomp_size - FF_INPUT_BUFFER_PADDING_SIZE;
+ int inlen = buf_size;
if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen)) {
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
return AVERROR_INVALIDDATA;
}
buf = c->decomp_buf;
- buf_size = c->decomp_size;
+ buf_size = outlen;
}
if (c->codec_frameheader) {
int w, h, q;
More information about the ffmpeg-cvslog
mailing list