Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/cscd: Check for CamStudio Lossless Codec 1.0 behavior in end check
@ 2023-03-08 22:43 Michael Niedermayer
  2023-09-10 14:30 ` Michael Niedermayer
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Niedermayer @ 2023-03-08 22:43 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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(-)

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;
         }
-- 
2.17.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-10 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 22:43 [FFmpeg-devel] [PATCH] avcodec/cscd: Check for CamStudio Lossless Codec 1.0 behavior in end check Michael Niedermayer
2023-09-10 14:30 ` Michael Niedermayer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git