This will fix following compile warning: libavutil/video_enc_params.c: In function ‘av_video_enc_params_alloc’: libavutil/video_enc_params.c:36:19: warning: comparison is always false due to limited range of data type [-Wtype-limits] 36 | if (nb_blocks > SIZE_MAX / sizeof(AVVideoBlockParams) || | ^
Suppose a is "nb_blocks > SIZE_MAX / sizeof(AVVideoBlockParams))" b is "nb_blocks * sizeof(AVVideoBlockParams) > SIZE_MAX - sizw" If a is true, b is true. If a is false, the expression depends on b. No matter a is true or not, it we only need check b. --- libavutil/video_enc_params.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavutil/video_enc_params.c b/libavutil/video_enc_params.c index c46c0f1dc6..31bce6a277 100644 --- a/libavutil/video_enc_params.c +++ b/libavutil/video_enc_params.c @@ -33,8 +33,7 @@ AVVideoEncParams *av_video_enc_params_alloc(enum AVVideoEncParamsType type, size_t size; size = sizeof(*par); - if (nb_blocks > SIZE_MAX / sizeof(AVVideoBlockParams) || - nb_blocks * sizeof(AVVideoBlockParams) > SIZE_MAX - size) + if (nb_blocks * sizeof(AVVideoBlockParams) > SIZE_MAX - size) return NULL; size += sizeof(AVVideoBlockParams) * nb_blocks; -- 2.25.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".