Message ID | 20230308224338.31226-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | d2a0464fc2dd6f79571a66e6c7a8168323168e46 |
Headers | show |
Series | [FFmpeg-devel] avcodec/cscd: Check for CamStudio Lossless Codec 1.0 behavior in end check | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On Wed, Mar 08, 2023 at 11:43:38PM +0100, Michael Niedermayer wrote: > Alternatively the check could be simply made more tolerant > Fixes: Ticket10227 > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavcodec/cscd.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) will apply [...]
diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c index b4ed3332a9..5d55f6e4d1 100644 --- a/libavcodec/cscd.c +++ b/libavcodec/cscd.c @@ -83,7 +83,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, switch ((buf[0] >> 1) & 7) { case 0: { // lzo compression int outlen = c->decomp_size, inlen = buf_size - 2; - if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen) || outlen) { + int bpp = avctx->bits_per_coded_sample / 8; + int bugdelta = FFALIGN(avctx->width * bpp, 4) * avctx->height + - (avctx->width & ~3) * bpp * avctx->height; + if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen) || (outlen && outlen != bugdelta)) { av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n"); return AVERROR_INVALIDDATA; }
Alternatively the check could be simply made more tolerant Fixes: Ticket10227 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/cscd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)