mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-24 02:09:03 +03:00
avfilter/vf_libopencv: let the shape file alone define the element size
For CV_SHAPE_CUSTOM the documentation states that cols and rows from the filter parameters are ignored and the size is taken from the file, but read_shape_from_file() used the caller supplied values as a baseline: *rows was incremented and *cols was raised to the file width. Reset both so that only the file content matters. This also removes two remaining out-of-bounds accesses in the fill loop, which are reachable with a custom shape file whose content is empty or whose last line lacks the terminating newline. Assisted-by: Fairy
This commit is contained in:
committed by
michaelni
parent
32d2145fa5
commit
3fdca8345b
@@ -136,6 +136,9 @@ static int read_shape_from_file(int *cols, int *rows, int **values, const char *
|
||||
if ((ret = av_file_map(filename, &buf, &size, 0, log_ctx)) < 0)
|
||||
return ret;
|
||||
|
||||
/* the file alone defines the size of the shape */
|
||||
*cols = *rows = 0;
|
||||
|
||||
/* prescan file to get the number of lines and the maximum width */
|
||||
w = 0;
|
||||
for (i = 0; i < size; i++) {
|
||||
|
||||
Reference in New Issue
Block a user