diff mbox series

[FFmpeg-devel,2/2] swscale/swscale: Check srcSliceH for bayer

Message ID 20240217170947.25351-2-michael@niedermayer.cc
State Accepted
Commit 64098d0cd8ab1d27f78a335ca684f00a419b2160
Headers show
Series [FFmpeg-devel,1/2] swscale/utils: Allocate more dithererror | 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 Feb. 17, 2024, 5:09 p.m. UTC
Fixes: Assertion srcSliceH > 1 failed at libswscale/swscale_unscaled.c:1359
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libswscale/swscale.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 46ba68fe6a6..7bea5147db1 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -904,7 +904,8 @@  static int scale_internal(SwsContext *c,
 
     if ((srcSliceY  & (macro_height_src - 1)) ||
         ((srcSliceH & (macro_height_src - 1)) && srcSliceY + srcSliceH != c->srcH) ||
-        srcSliceY + srcSliceH > c->srcH) {
+        srcSliceY + srcSliceH > c->srcH ||
+        (isBayer(c->srcFormat) && srcSliceH <= 1)) {
         av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", srcSliceY, srcSliceH);
         return AVERROR(EINVAL);
     }