summaryrefslogtreecommitdiff
path: root/libavcodec/gifdec.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2013-01-25 12:46:57 +0000
committerPaul B Mahol <onemda@gmail.com>2013-01-25 12:54:15 +0000
commit51c7af9d32376df4522bc948e45fea5ef75af31c (patch)
tree4fa2d17576871f24fb4b97dbd37b67e7167a1c1e /libavcodec/gifdec.c
parent285128eedf9efa9bd3cae1a5b79cb97bd05bb104 (diff)
lavc/gifdec: move idx_line allocation out of gif_read_header1()
Now allocation is done only if av_image_check_size() passes. Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/gifdec.c')
-rw-r--r--libavcodec/gifdec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
index 90aaa46e85..b43dd6e141 100644
--- a/libavcodec/gifdec.c
+++ b/libavcodec/gifdec.c
@@ -376,10 +376,6 @@ static int gif_read_header1(GifState *s)
return AVERROR_INVALIDDATA;
}
- av_fast_malloc(&s->idx_line, &s->idx_line_size, s->screen_width);
- if (!s->idx_line)
- return AVERROR(ENOMEM);
-
v = bytestream2_get_byteu(&s->gb);
s->color_resolution = ((v & 0x70) >> 4) + 1;
s->has_global_palette = (v & 0x80);
@@ -486,6 +482,10 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, A
return ret;
}
+ av_fast_malloc(&s->idx_line, &s->idx_line_size, s->screen_width);
+ if (!s->idx_line)
+ return AVERROR(ENOMEM);
+
s->picture.pict_type = AV_PICTURE_TYPE_I;
s->picture.key_frame = 1;
s->keyframe_ok = 1;