Commit 9df01f8a by Jamie Madill Committed by Commit Bot

Fix overflow in ImageIndexIterator::done.

The maxLayer() method was reading out of range for 2D arrays. BUG=644846,614178 BUG=angleproject:1493 Change-Id: I7cc4773d1ee9ff2d0a18cb0a8e916cf3687446db Reviewed-on: https://chromium-review.googlesource.com/382332 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent b6c3e77b
...@@ -135,7 +135,12 @@ ImageIndexIterator::ImageIndexIterator(GLenum type, const Range<GLint> &mipRange ...@@ -135,7 +135,12 @@ ImageIndexIterator::ImageIndexIterator(GLenum type, const Range<GLint> &mipRange
GLint ImageIndexIterator::maxLayer() const GLint ImageIndexIterator::maxLayer() const
{ {
return (mLayerCounts ? static_cast<GLint>(mLayerCounts[mCurrentMip]) : mLayerRange.end); if (mLayerCounts)
{
ASSERT(mCurrentMip >= 0);
return (mCurrentMip < mMipRange.end) ? mLayerCounts[mCurrentMip] : 0;
}
return mLayerRange.end;
} }
ImageIndex ImageIndexIterator::next() ImageIndex ImageIndexIterator::next()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment