From: Mika Isojärvi Date: Thu, 10 Mar 2016 22:16:47 +0000 (-0800) Subject: Fix out of bounds access in internal format query tests X-Git-Tag: upstream/0.1.0~438^2~374^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96cb7f12003c49de4b9462e237eade317371fcce;p=platform%2Fupstream%2FVK-GL-CTS.git Fix out of bounds access in internal format query tests Bug: 27570736 Change-Id: Id95f80765b3ed020515edb544cf871282672d802 --- diff --git a/modules/gles31/functional/es31fInternalFormatQueryTests.cpp b/modules/gles31/functional/es31fInternalFormatQueryTests.cpp index 55b6e6a..013f357 100644 --- a/modules/gles31/functional/es31fInternalFormatQueryTests.cpp +++ b/modules/gles31/functional/es31fInternalFormatQueryTests.cpp @@ -140,13 +140,11 @@ FormatSamplesCase::IterateResult FormatSamplesCase::iterate (void) // Sample counts { - tcu::MessageBuilder samplesMsg(&m_testCtx.getLog()); - std::vector samples; + tcu::MessageBuilder samplesMsg (&m_testCtx.getLog()); + std::vector samples (numSampleCounts > 0 ? numSampleCounts : 1); if (numSampleCounts > 0 || isFloatFormat) { - samples.resize(numSampleCounts, -1); - gl.getInternalformativ(m_target, m_internalFormat, GL_SAMPLES, numSampleCounts, &samples[0]); GLU_EXPECT_NO_ERROR(gl.getError(), "get GL_SAMPLES"); } @@ -156,7 +154,7 @@ FormatSamplesCase::IterateResult FormatSamplesCase::iterate (void) // make a pretty log samplesMsg << "GL_SAMPLES = ["; - for (int ndx = 0; ndx < numSampleCounts; ++ndx) + for (size_t ndx = 0; ndx < samples.size(); ++ndx) { if (ndx) samplesMsg << ", "; @@ -165,7 +163,7 @@ FormatSamplesCase::IterateResult FormatSamplesCase::iterate (void) samplesMsg << "]" << tcu::TestLog::EndMessage; // Samples are in order - for (int ndx = 1; ndx < numSampleCounts; ++ndx) + for (size_t ndx = 1; ndx < samples.size(); ++ndx) { if (samples[ndx-1] <= samples[ndx]) { @@ -176,7 +174,7 @@ FormatSamplesCase::IterateResult FormatSamplesCase::iterate (void) } // samples are positive - for (int ndx = 1; ndx < numSampleCounts; ++ndx) + for (size_t ndx = 1; ndx < samples.size(); ++ndx) { if (samples[ndx-1] <= 0) {