[FFmpeg-cvslog] avcodec/cscd: Check for CamStudio Lossless Codec 1.0 behavior in end check of LZO files
Michael Niedermayer
git at videolan.org
Sun Apr 14 23:23:36 EEST 2024
ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Wed Mar 8 22:11:59 2023 +0100| [545b76d7b12a58702c7ee6ef53a5bec9e8dc5914] | committer: Michael Niedermayer
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 <michael at niedermayer.cc>
(cherry picked from commit d2a0464fc2dd6f79571a66e6c7a8168323168e46)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=545b76d7b12a58702c7ee6ef53a5bec9e8dc5914
---
libavcodec/cscd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c
index e2d868353f..d5a20ce04b 100644
--- a/libavcodec/cscd.c
+++ b/libavcodec/cscd.c
@@ -84,7 +84,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
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;
}
More information about the ffmpeg-cvslog
mailing list