From 70b202a8f45d00fb7b4cb57bd09f9bac966ff98d Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Sun, 10 Nov 2024 12:34:10 -0500 Subject: [PATCH] video/out/gpu/video: prevent OOB access when larger angles are used --- video/out/gpu/video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index 6bd1bf1169..d5bbbbfec7 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -774,7 +774,7 @@ static int pass_bind(struct gl_video *p, struct image img) static void get_transform(float w, float h, int rotate, bool flip, struct gl_transform *out_tr) { - int a = rotate % 90 ? 0 : rotate / 90; + int a = rotate % 90 ? 0 : (rotate / 90) % 4; int sin90[4] = {0, 1, 0, -1}; // just to avoid rounding issues etc. int cos90[4] = {1, 0, -1, 0}; struct gl_transform tr = {{{ cos90[a], sin90[a]},