diff mbox series

[FFmpeg-devel,3/4] avcodec/lcldec: 420 seems missing 2 bytes, ignore that

Message ID 20230309125717.29821-3-michael@niedermayer.cc
State Accepted
Commit 4ea28554db5195a3981822f88e55262ed0429411
Headers show
Series [FFmpeg-devel,1/4] libavcodec/lcldec: width and height should not be unsigned | expand

Checks

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

Commit Message

Michael Niedermayer March 9, 2023, 12:57 p.m. UTC
Fixes: Ticket 10238
Fixes: mszh_306_306_yuv420.avi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/lcldec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 0196460eb2..f9a0755e4d 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -219,7 +219,9 @@  static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                 if (c->decomp_size != mszh_dlen) {
                     av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %d)\n",
                            c->decomp_size, mszh_dlen);
-                    return AVERROR_INVALIDDATA;
+                    if (c->decomp_size != mszh_dlen &&
+                        c->decomp_size != mszh_dlen + 2) // YUV420 306x306 is missing 2 bytes
+                        return AVERROR_INVALIDDATA;
                 }
                 encoded = c->decomp_buf;
                 len = mszh_dlen;