aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/lagarith.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-10 18:48:51 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-10 18:48:51 +0100
commitad4963a944644d390a813755ded833ba4a2ca367 (patch)
tree57b0e196784d6de0d423d3dc4bb0a992f784f29b /libavcodec/lagarith.c
parent5640ea43d7202e6bc6bc032079f66456323d1008 (diff)
parent0120e480bf0a1257299c8c84416a8814ccfcc73b (diff)
downloadffmpeg-ad4963a944644d390a813755ded833ba4a2ca367.tar.gz
Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8: arm: hpeldsp: fix put_pixels8_y2_{,no_rnd_}armv6 arm: hpeldsp: prevent overreads in armv6 asm lagarith: reallocate rgb_planes when needed lagarith: avoid infinite loop in lag_rac_refill() Conflicts: libavcodec/lagarith.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/lagarith.c')
-rw-r--r--libavcodec/lagarith.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index addd4814ce..a1c6dcdaa6 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -52,6 +52,7 @@ typedef struct LagarithContext {
int zeros; /**< number of consecutive zero bytes encountered */
int zeros_rem; /**< number of zero bytes remaining to output */
uint8_t *rgb_planes;
+ int rgb_planes_allocated;
int rgb_stride;
} LagarithContext;
@@ -507,13 +508,12 @@ static int lag_decode_frame(AVCodecContext *avctx,
offs[2] = 13;
offs[3] = AV_RL32(buf + 9);
+ l->rgb_stride = FFALIGN(avctx->width, 16);
+ av_fast_malloc(&l->rgb_planes, &l->rgb_planes_allocated,
+ l->rgb_stride * avctx->height * 4 + 1);
if (!l->rgb_planes) {
- l->rgb_stride = FFALIGN(avctx->width, 16);
- l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * 4 + 1);
- if (!l->rgb_planes) {
- av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n");
- return AVERROR(ENOMEM);
- }
+ av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n");
+ return AVERROR(ENOMEM);
}
for (i = 0; i < 4; i++)
srcs[i] = l->rgb_planes + (i + 1) * l->rgb_stride * avctx->height - l->rgb_stride;