[FFmpeg-devel] [PATCH 20/22] avutil/frame: Check log2_crop_align

Michael Niedermayer michael at niedermayer.cc
Fri Jul 12 02:34:14 EEST 2024


Fixes: CID1604586 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavutil/frame.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index 0775e2abd9d..673a9afb3bf 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -1107,7 +1107,7 @@ int av_frame_apply_cropping(AVFrame *frame, int flags)
         if (log2_crop_align < min_log2_align)
             return AVERROR_BUG;
 
-        if (min_log2_align < 5) {
+        if (min_log2_align < 5 && log2_crop_align != INT_MAX) {
             frame->crop_left &= ~((1 << (5 + log2_crop_align - min_log2_align)) - 1);
             calc_cropping_offsets(offsets, frame, desc);
         }
-- 
2.45.2



More information about the ffmpeg-devel mailing list