summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-14 10:35:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-14 10:38:11 +0200
commit86fe16a763abf2d44a9d3c2ed6d19324239731e4 (patch)
treed81418febd38d65bb8deaa9d0cc46a83bdcd74b5
parent7ec7d626a12164ef4195c57f5a016c9e0e26f2f5 (diff)
parent075dbc185521f193c98b896cd63be3ec2613df5d (diff)
Merge commit '075dbc185521f193c98b896cd63be3ec2613df5d'
* commit '075dbc185521f193c98b896cd63be3ec2613df5d': nuv: Pad the lzo outbuf Conflicts: libavcodec/nuv.c See: 95e1dfee76c9ecdf70037b7e792897bc6e3d460b See: 266f6eefc603dd3c34be7de94eec5c9c293b80f1 Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/nuv.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index 3888c0c550..edb38c303e 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -122,7 +122,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height,
get_quant_quality(c, quality);
if (width != c->width || height != c->height) {
// also reserve space for a possible additional header
- int buf_size = 24 + height * width * 3 / 2 + AV_LZO_OUTPUT_PADDING;
+ int buf_size = 24 + height * width * 3 / 2 + FFMAX(AV_LZO_OUTPUT_PADDING, FF_INPUT_BUFFER_PADDING_SIZE);
if (buf_size > INT_MAX/8)
return -1;
if ((ret = av_image_check_size(height, width, 0, avctx)) < 0)
@@ -207,13 +207,14 @@ retry:
buf = &buf[12];
buf_size -= 12;
if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
- int outlen = c->decomp_size - AV_LZO_OUTPUT_PADDING, inlen = buf_size;
+ int outlen = c->decomp_size - FFMAX(FF_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING);
+ 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 - AV_LZO_OUTPUT_PADDING - outlen;
+ buf_size = c->decomp_size - FFMAX(FF_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING) - outlen;
}
if (c->codec_frameheader) {
int w, h, q;