Skip to content

Commit d2a0464

Browse files
committed
avcodec/cscd: Check for CamStudio Lossless Codec 1.0 behavior in end check of LZO files
Alternatively the check could be simply made more tolerant Fixes: Ticket10227 Signed-off-by: Michael Niedermayer <[email protected]>
1 parent c6f0fd2 commit d2a0464

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libavcodec/cscd.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
8383
switch ((buf[0] >> 1) & 7) {
8484
case 0: { // lzo compression
8585
int outlen = c->decomp_size, inlen = buf_size - 2;
86-
if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen) || outlen) {
86+
int bpp = avctx->bits_per_coded_sample / 8;
87+
int bugdelta = FFALIGN(avctx->width * bpp, 4) * avctx->height
88+
- (avctx->width & ~3) * bpp * avctx->height;
89+
if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen) || (outlen && outlen != bugdelta)) {
8790
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
8891
return AVERROR_INVALIDDATA;
8992
}

0 commit comments

Comments
 (0)