avutil/imgutils: compute the line size of bitstream formats without overflow

Fixes: signed integer overflow
Fixes: P0BVJKDC5JLx
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24756
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
This commit is contained in:
Michael Niedermayer authored and michaelni committed 2026-10-12 21:18:53 +00:00
1 parent c61944093f
commit bc74cf91f0
1 file changed
+1 -1
+1 -1
View File
@@ -69,7 +69,7 @@ int image_get_linesize(int width, int plane,
linesize = max_step * shifted_w;
if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
linesize = (linesize + 7) >> 3;
linesize = (linesize >> 3) + !!(linesize & 7);
return linesize;
}