Fix vector access in EGL partial update tests
authorGraeme Leese <gleese@broadcom.com>
Wed, 15 Sep 2021 09:23:00 +0000 (10:23 +0100)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Fri, 1 Oct 2021 20:51:06 +0000 (20:51 +0000)
The vector of damage regions was being accessed even when the vector
was empty, which is invalid.

This changes the behaviour of the test, which used to invalidate the
whole framebuffer when it found no damage regions, but not invalidates
none of it. This seems like the correct behaviour.

Components: EGL
Affects: dEQP-EGL.functional.partial_update.*

Change-Id: I8c5500a85d000d16b240359de7eadc67144fb7d3

modules/egl/teglPartialUpdateTests.cpp

index f496533..4c938ec 100644 (file)
@@ -547,12 +547,13 @@ TestCase::IterateResult PartialUpdateTest::iterate (void)
                        else
                        {
                                damageRegion = getDamageRegion(newFrame, 0, 0, 0, 0);
-                               // Set empty damage region to avoid invalidating the framebuffer. The damage area is invalidated
-                               // if the buffer age extension is not supported.
-                               if (damageRegion.size() == 0)
-                                       damageRegion = vector<EGLint>(4, 0);
                        }
 
+                       // Set empty damage region to avoid invalidating the framebuffer. The damage area is invalidated
+                       // if the buffer age extension is not supported.
+                       if (damageRegion.size() == 0)
+                               damageRegion = vector<EGLint>(4, 0);
+
                        EGLU_CHECK_CALL(egl, setDamageRegionKHR(m_eglDisplay, m_eglSurface, &damageRegion[0], (EGLint)damageRegion.size()/4));
                }
                else