From 269f4a3024f05378a2305b15be41d35e867dae51 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Fri, 22 Oct 2021 14:20:26 +0200 Subject: Fix VSE left crop not working Caused by using 3D math on 2D vectors, violating memory boundaries. Use temporary float[3] variable. --- source/blender/imbuf/intern/imageprocess.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'source/blender/imbuf/intern/imageprocess.c') diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index f01d2efa3ed..0ec1e4c19d8 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -388,13 +388,15 @@ static void imb_transform_calc_add_x(const float transform_matrix[4][4], const int width, float r_add_x[2]) { + float r_add_x_temp[3]; float uv_max_x[3]; zero_v3(uv_max_x); uv_max_x[0] = width; uv_max_x[1] = 0.0f; - mul_v3_m4v3(r_add_x, transform_matrix, uv_max_x); - sub_v2_v2(r_add_x, start_uv); - mul_v2_fl(r_add_x, 1.0f / width); + mul_v3_m4v3(r_add_x_temp, transform_matrix, uv_max_x); + sub_v2_v2(r_add_x_temp, start_uv); + mul_v2_fl(r_add_x_temp, 1.0f / width); + copy_v2_v2(r_add_x, r_add_x_temp); } static void imb_transform_calc_add_y(const float transform_matrix[4][4], @@ -402,13 +404,15 @@ static void imb_transform_calc_add_y(const float transform_matrix[4][4], const int height, float r_add_y[2]) { + float r_add_y_temp[3]; float uv_max_y[3]; zero_v3(uv_max_y); uv_max_y[0] = 0.0f; uv_max_y[1] = height; - mul_v3_m4v3(r_add_y, transform_matrix, uv_max_y); - sub_v2_v2(r_add_y, start_uv); - mul_v2_fl(r_add_y, 1.0f / height); + mul_v3_m4v3(r_add_y_temp, transform_matrix, uv_max_y); + sub_v2_v2(r_add_y_temp, start_uv); + mul_v2_fl(r_add_y_temp, 1.0f / height); + copy_v2_v2(r_add_y, r_add_y_temp); } typedef void (*InterpolationColorFunction)( -- cgit v1.2.3