[Libva] [PATCH 3/5] Fix buffer overflow for array index out of bounds in test_07

Lim Siew Hoon siew.hoon.lim at intel.com
Fri Jul 1 03:13:23 UTC 2016


The size of array surface_1 is 2, but it passed to test_unique_surfaces
func is 16 or 6 to do compare for surface_16. The index for surface_1
not in the array index range for surface_1 and access invalid memory
location.

Signed-off-by: Lim Siew Hoon <siew.hoon.lim at intel.com>
---
 test/basic/test_07.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/basic/test_07.c b/test/basic/test_07.c
index 2e01533..752b0bf 100644
--- a/test/basic/test_07.c
+++ b/test/basic/test_07.c
@@ -84,7 +84,7 @@ void test()
     test_unique_surfaces(surfaces_4, 4, surfaces_16, 4);
     test_unique_surfaces(surfaces_4, 4, surfaces_16, 16);
     test_unique_surfaces(surfaces_4, 1, surfaces_16, 16);
-    test_unique_surfaces(surfaces_1, 16, surfaces_16, 16);
+    test_unique_surfaces(surfaces_1, 1, surfaces_16, 16);
 
     status("vaDestroySurface 4 surfaces\n");
     va_status = vaDestroySurfaces(va_dpy, surfaces_4, 4);
@@ -98,7 +98,7 @@ void test()
 
     test_unique_surfaces(surfaces_1, 1, surfaces_6, 6);
     test_unique_surfaces(surfaces_6, 6, surfaces_16, 16);
-    test_unique_surfaces(surfaces_1, 6, surfaces_16, 6);
+    test_unique_surfaces(surfaces_1, 1, surfaces_16, 6);
 
     status("vaDestroySurface 16 surfaces\n");
     va_status = vaDestroySurfaces(va_dpy, surfaces_16, 16);
-- 
2.1.0



More information about the Libva mailing list