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

Git pushed a commit to branch master
in repository ffmpeg.

commit 1257f26120a01a972ffbffc49a57c9b812d766ed
Author:     Niklas Haas <[email protected]>
AuthorDate: Tue Jun 9 20:19:23 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Thu Jun 25 01:20:48 2026 +0200

    swscale/ops: make ff_sws_apply_op_q slightly more robust
    
    Switch on the exact pixel type and add a range assertion.
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/libswscale/ops.c b/libswscale/ops.c
index 666a570216..7d7c22a006 100644
--- a/libswscale/ops.c
+++ b/libswscale/ops.c
@@ -218,17 +218,21 @@ void ff_sws_apply_op_q(const SwsOp *op, AVRational64 x[4])
         return;
     }
     case SWS_OP_SWAP_BYTES:
-        av_assert1(ff_sws_pixel_type_is_int(op->type));
-        switch (ff_sws_pixel_type_size(op->type)) {
-        case 2:
-            for (int i = 0; i < 4; i++)
+        switch (op->type) {
+        case SWS_PIXEL_U16:
+            for (int i = 0; i < 4; i++) {
+                av_assert2(x[i].num >= 0 && x[i].num <= UINT16_MAX);
                 x[i].num = av_bswap16(x[i].num);
-            break;
-        case 4:
-            for (int i = 0; i < 4; i++)
+            }
+            return;
+        case SWS_PIXEL_U32:
+            for (int i = 0; i < 4; i++) {
+                av_assert2(x[i].num >= 0 && x[i].num <= UINT32_MAX);
                 x[i].num = av_bswap32(x[i].num);
-            break;
+            }
+            return;
         }
+        av_unreachable("Invalid pixel type for SWS_OP_SWAP_BYTES!");
         return;
     case SWS_OP_CLEAR:
         for (int i = 0; i < 4; i++) {

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

Reply via email to