Commit 916da13d authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

cfhd: fix off-by-one error in level check

This fixes out-of-bounds writes causing segmentation faults.
Found-by: 's avatarPiotr Bandurski <ami_stuff@o2.pl>
Reviewed-by: 's avatarKieran Kunhya <kierank@obe.tv>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent e9025573
......@@ -280,7 +280,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
s->level++;
av_log(avctx, AV_LOG_DEBUG, "Subband number %"PRIu16"\n", data);
s->subband_num = data;
if (s->level > DWT_LEVELS) {
if (s->level >= DWT_LEVELS) {
av_log(avctx, AV_LOG_ERROR, "Invalid level\n");
ret = AVERROR(EINVAL);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment