Fix out of bounds access in draw buffers indexed tests
authorMika Isojärvi <misojarvi@google.com>
Mon, 14 Mar 2016 16:21:30 +0000 (09:21 -0700)
committerMika Isojärvi <misojarvi@google.com>
Mon, 14 Mar 2016 16:21:30 +0000 (09:21 -0700)
Change-Id: I42449896c58a5b7276b5876c26333b09cd863cae

modules/gles31/functional/es31fDrawBuffersIndexedTests.cpp

index 58e0d1d..df481db 100644 (file)
@@ -1339,7 +1339,7 @@ TextureFormat getRandomFormat (de::Random& rng, Context& context)
        if (isES32)
                return glu::mapGLInternalFormat(de::getArrayElement(glFormats, rng.getUint32() % DE_LENGTH_OF_ARRAY(glFormats)));
        else
-               return glu::mapGLInternalFormat(de::getArrayElement(glFormats, rng.getUint32() % DE_LENGTH_OF_ARRAY(glFormats) - 6));
+               return glu::mapGLInternalFormat(de::getArrayElement(glFormats, rng.getUint32() % (DE_LENGTH_OF_ARRAY(glFormats) - 6)));
 }
 
 void genRandomTest (de::Random& rng, BlendState& preCommon, BlendState& postCommon, vector<DrawBufferInfo>& drawBuffers, int maxDrawBufferCount, Context& context)