diff options
author | Kieran Kunhya <kieran@kunhya.com> | 2016-01-31 23:59:52 +0000 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-07-25 13:56:57 +0200 |
commit | b829c5b5848107491fc6877e9608cf152afa38a5 (patch) | |
tree | 19ed4567a31e3024183cfe378abcfa16d2411117 | |
parent | 090403e4c8b6b1ec3b67da57f7d3f7a6d2475c4a (diff) |
cfhd: Make sure we have an end of header tag before allocating a frame
-rw-r--r-- | libavcodec/cfhd.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 115081c68e..410bb7b8f7 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -224,7 +224,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, GetByteContext gb; ThreadFrame frame = { .f = data }; AVFrame *pic = data; - int ret = 0, i, j, plane; + int ret = 0, i, j, plane, got_buffer = 0; int16_t *coeff_data; avctx->pix_fmt = AV_PIX_FMT_YUV422P10; @@ -426,6 +426,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, s->coded_width = 0; s->coded_height = 0; + got_buffer = 1; } coeff_data = s->plane[s->channel_num].subband[s->subband_num_actual]; @@ -557,6 +558,12 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, goto end; } + if (!got_buffer) { + av_log(avctx, AV_LOG_ERROR, "No end of header tag found\n"); + ret = AVERROR(EINVAL); + goto end; + } + for (plane = 0; plane < 3 && !ret; plane++) { /* level 1 */ int lowpass_height = s->plane[plane].band[0][0].height; |