History

avfilter/vf_deshake_opencl: Use AV_VIDEO_MAX_PLANES

Fixes: CID1452758 Out-of-bounds read (actual out of bounds access depends on a frame with more than 3 planes)

Michael Niedermayer committed 2 years ago

Commit c37dc631 parent 9b9e02f1 file · +4 −4Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_deshake_opencl.c+4−4
@@ -1387,8 +1387,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *input_frame) · 1386 unmodified lines
13871387 size_t global_work[2];
13881388 int64_t duration;
13891389 cl_mem src, transformed, dst;
1390− cl_mem transforms[3];
1391− CropInfo crops[3];
1390+ cl_mem transforms[AV_VIDEO_MAX_PLANES];
1391+ CropInfo crops[AV_VIDEO_MAX_PLANES];
13921392 cl_event transform_event, crop_upscale_event;
13931393 DebugMatches debug_matches;
13941394 cl_int num_model_matches;
@@ -1518,7 +1518,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *input_frame) · 123 unmodified lines
15181518 transforms[0] = deshake_ctx->transform_y;
15191519 transforms[1] = transforms[2] = deshake_ctx->transform_uv;
15201520
1521− for (int p = 0; p < FF_ARRAY_ELEMS(transformed_frame->data); p++) {
1521+ for (int p = 0; p < AV_VIDEO_MAX_PLANES; p++) {
15221522 // Transform all of the planes appropriately
15231523 src = (cl_mem)input_frame->data[p];
15241524 transformed = (cl_mem)transformed_frame->data[p];
@@ -1619,7 +1619,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *input_frame) · 94 unmodified lines
16191619 crops[0] = deshake_ctx->crop_y;
16201620 crops[1] = crops[2] = deshake_ctx->crop_uv;
16211621
1622− for (int p = 0; p < FF_ARRAY_ELEMS(cropped_frame->data); p++) {
1622+ for (int p = 0; p < AV_VIDEO_MAX_PLANES; p++) {
16231623 // Crop all of the planes appropriately
16241624 dst = (cl_mem)cropped_frame->data[p];
16251625 transformed = (cl_mem)transformed_frame->data[p];

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