[FFmpeg-devel] [PATCH 1/3] swscale/swscale_internal: Avoid unsigned for slice parameters

Michael Niedermayer michael at niedermayer.cc
Thu Sep 30 20:16:38 EEST 2021


Mixing unsigned and signed often leads to unexpected arithmetic results.
Fixes: out of array write
Found-by: <durandal_1707>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libswscale/swscale_internal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index e6e7b934b68..708facba676 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -311,8 +311,8 @@ typedef struct SwsContext {
     int              nb_slice_ctx;
 
     // values passed to current sws_receive_slice() call
-    unsigned int dst_slice_start;
-    unsigned int dst_slice_height;
+    int dst_slice_start;
+    int dst_slice_height;
 
     /**
      * Note that src, dst, srcStride, dstStride will be copied in the
-- 
2.17.1



More information about the ffmpeg-devel mailing list