History

avutil/frame: use size_t for total_size in get_video_buffer()

James Almer committed 1 year ago

Commit 09122bd1 parent 2d077f91 file · +3 −3Browse files

Unified · Split

libavutil/frame.c+3−3
@@ -173,10 +173,10 @@ void av_frame_free(AVFrame **frame) · 172 unmodified lines
173static int get_video_buffer(AVFrame *frame, int align)173static int get_video_buffer(AVFrame *frame, int align)
174{174{
175 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);175 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
176 int ret, padded_height, total_size;176 int ret, padded_height;
177 int plane_padding = FFMAX(16 + 16/*STRIDE_ALIGN*/, align);177 int plane_padding = FFMAX(16 + 16/*STRIDE_ALIGN*/, align);
178 ptrdiff_t linesizes[4];178 ptrdiff_t linesizes[4];
179 size_t sizes[4];179 size_t total_size, sizes[4];
180 180
181 if (!desc)181 if (!desc)
182 return AVERROR(EINVAL);182 return AVERROR(EINVAL);
@@ -211,7 +211,7 @@ static int get_video_buffer(AVFrame *frame, int align) · 28 unmodified lines
211 211
212 total_size = 4*plane_padding;212 total_size = 4*plane_padding;
213 for (int i = 0; i < 4; i++) {213 for (int i = 0; i < 4; i++) {
214 if (sizes[i] > INT_MAX - total_size)214 if (sizes[i] > SIZE_MAX - total_size)
215 return AVERROR(EINVAL);215 return AVERROR(EINVAL);
216 total_size += sizes[i];216 total_size += sizes[i];
217 }217 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t