Commit 178cd50c authored by Paul B Mahol's avatar Paul B Mahol

avcodec/scpr: make sure that component value is <= 0x1F for 16 bpc

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent fa3e4956
......@@ -58,6 +58,7 @@ typedef struct SCPRContext {
unsigned nbx, nby;
unsigned nbcount;
unsigned *blocks;
unsigned cbits;
int cxshift;
} SCPRContext;
......@@ -241,7 +242,7 @@ static int decode_unit(SCPRContext *s, PixelModel *pixel, unsigned step, unsigne
}
pixel->total_freq = totfr;
*rval = c;
*rval = c & s->cbits;
return 0;
}
......@@ -789,6 +790,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
s->cxshift = avctx->bits_per_coded_sample == 16 ? 0 : 2;
s->cbits = avctx->bits_per_coded_sample == 16 ? 0x1F : 0xFF;
s->nbx = (avctx->width + 15) / 16;
s->nby = (avctx->height + 15) / 16;
s->nbcount = s->nbx * s->nby;
......
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