mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-24 02:09:03 +03:00
avfilter/vf_libopencv: reject shapes too big for OpenCV
Fixes: out of array write Fixes: EVA3Y4e693ul Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24753 Out of array write Replicated through UnModified FFmpeg with ASAN
This commit is contained in:
committed by
michaelni
parent
c23f784451
commit
f703292c42
@@ -240,6 +240,12 @@ static int parse_iplconvkernel(IplConvKernel **kernel, char *buf, void *log_ctx)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (rows > (INT_MAX - sizeof(IplConvKernel) - 32) / sizeof(int) / cols) {
|
||||
av_log(log_ctx, AV_LOG_ERROR, "Shape size %dx%d is too big\n", cols, rows);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (anchor_x < 0 || anchor_y < 0 || anchor_x >= cols || anchor_y >= rows) {
|
||||
av_log(log_ctx, AV_LOG_ERROR,
|
||||
"Shape anchor %dx%d is not inside the rectangle with size %dx%d.\n",
|
||||
|
||||
Reference in New Issue
Block a user