This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 16a57b2985b8260e0e3e295f9621ff8a5de1f80b
Author:     Niklas Haas <[email protected]>
AuthorDate: Wed Apr 15 20:44:04 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Thu Apr 16 20:59:39 2026 +0000

    swscale/ops_dispatch: ensure block size is multiple of pixel size
    
    This could trigger if e.g. a backend tries to operate on monow formats with
    a block size that is not a multiple of 1. In this case, `block_size_in`
    would previously be miscomputed (to e.g. 0), which is obviously wrong.
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops_dispatch.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c
index c14cf79562..d8a79e116b 100644
--- a/libswscale/ops_dispatch.c
+++ b/libswscale/ops_dispatch.c
@@ -430,10 +430,19 @@ static int compile(SwsGraph *graph, const SwsOpList *ops, 
SwsPass *input,
     p->exec_base = (SwsOpExec) {
         .width  = dst->width,
         .height = dst->height,
-        .block_size_in  = comp->block_size * p->pixel_bits_in  >> 3,
-        .block_size_out = comp->block_size * p->pixel_bits_out >> 3,
     };
 
+    const int64_t block_bits_in  = (int64_t) comp->block_size * 
p->pixel_bits_in;
+    const int64_t block_bits_out = (int64_t) comp->block_size * 
p->pixel_bits_out;
+    if (block_bits_in & 0x7 || block_bits_out & 0x7) {
+        av_log(ctx, AV_LOG_ERROR, "Block size must be a multiple of the pixel 
size.\n");
+        ret = AVERROR(EINVAL);
+        goto fail;
+    }
+
+    p->exec_base.block_size_in  = block_bits_in  >> 3;
+    p->exec_base.block_size_out = block_bits_out >> 3;
+
     for (int i = 0; i < 4; i++) {
         p->idx_in[i]  = i < p->planes_in  ? ops->plane_src[i] : -1;
         p->idx_out[i] = i < p->planes_out ? ops->plane_dst[i] : -1;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to