diff options
author | bohu <bohu@google.com> | 2014-10-17 13:48:06 -0700 |
---|---|---|
committer | bohu <bohu@google.com> | 2014-10-17 13:48:06 -0700 |
commit | 691e021d0fc09bf2e64656e3f6c4fb1edbba658d (patch) | |
tree | 43264d270a6c691d90caed5f23b915a8aba25080 | |
parent | 9c6d37269b85c41203a2f061958922315d55f6ce (diff) | |
download | android_device_generic_goldfish-691e021d0fc09bf2e64656e3f6c4fb1edbba658d.tar.gz android_device_generic_goldfish-691e021d0fc09bf2e64656e3f6c4fb1edbba658d.tar.bz2 android_device_generic_goldfish-691e021d0fc09bf2e64656e3f6c4fb1edbba658d.zip |
Guard against negative width and height
When negative width or height passes into pixelDataSize, some bogus
values are returned. This commit checks both width and height to make
sure they are valid.
Change-Id: Ia49a9f464e6bb4894207ca4e07bbfdf34fbe741d
-rw-r--r-- | opengl/shared/OpenglCodecCommon/GLClientState.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/opengl/shared/OpenglCodecCommon/GLClientState.cpp b/opengl/shared/OpenglCodecCommon/GLClientState.cpp index 9795490..a84e856 100644 --- a/opengl/shared/OpenglCodecCommon/GLClientState.cpp +++ b/opengl/shared/OpenglCodecCommon/GLClientState.cpp @@ -224,6 +224,8 @@ int GLClientState::setPixelStore(GLenum param, GLint value) size_t GLClientState::pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) const { + if (width <= 0 || height <= 0) return 0; + int pixelsize = glUtilsPixelBitSize(format, type) >> 3; int alignment = pack ? m_pixelStore.pack_alignment : m_pixelStore.unpack_alignment; |