Fix glcPackedPixelsTests to properly account for skip images
authorAntto Mäkinen <antto.makinen@siru.fi>
Fri, 12 Nov 2021 11:45:46 +0000 (13:45 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 18 Nov 2021 21:53:28 +0000 (21:53 +0000)
RectangleTest::makeGradient in glcPackedPixelsTests does not
properly account for skip images. This commit prevents it
writing over the end of an array.

Affects:

KHR-GL33.packed_pixels.*

Components: OpenGL ES

VK-GL-CTS Issue: 3275

Change-Id: I9d8a47b59c000512926c3bfc85b6c6dc66eee213

external/openglcts/modules/common/glcPackedPixelsTests.cpp

index f86038e..f37209e 100644 (file)
@@ -1247,12 +1247,13 @@ void RectangleTest::makeGradient(Type (*unpack)(float))
        const Type  defaultValue = unpack(0.5f);
        std::fill(data, data + dataToSkip, defaultValue);
 
-       for (int k = 0; k < depth; k++)
+       for (int k = m_unpackProperties.skipImages; k < depth; k++)
        {
                for (int j = 0; j < rowCount; j++)
                {
                        for (int i = 0; i < elementsInRow; i++)
                        {
+                               DE_ASSERT(index < bufferSize);
                                int x = i / elementsInGroup;
                                if ((k == depth - 1) && (m_unpackProperties.skipRows <= j) &&
                                        (j < m_unpackProperties.skipRows + GRADIENT_HEIGHT) && (m_unpackProperties.skipPixels <= x) &&