Skip to contentSkip to conversation

tests/kms_plane_scaling: Fix out-of-bound array access

PATCH New Swati Sharma 1 participant 1 message Mar 16, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/kms_plane_scaling: Fix out-of-bound array access

When k == n_planes - 1, we will try to access planes[n_planes], which is out of bounds. Fix this.

---
 tests/kms_plane_scaling.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/kms_plane_scaling.c +1 -1
index 3a6904afb..8d78752cc 100644
@@ -744,7 +744,7 @@ test_planes_scaling_combo(data_t *d, int w1, int h1, int w2, int h2,
 		igt_assert(0);
 	}
 
-	for (int k = 0; k < display->pipes[pipe].n_planes; k++) {
+	for (int k = 0; k < display->pipes[pipe].n_planes - 1; k++) {
 		igt_plane_t *p1, *p2;
 
 		p1 = &display->pipes[pipe].planes[k];
Signature · 1 line
2.25.1