summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2012-01-11 14:10:48 -0800
committerJesse Hall <jessehall@google.com>2012-01-11 15:40:29 -0800
commit5bad48a65e4f5b69002ac82505598c0adb4ebb35 (patch)
tree1bd00c70a01ed18c4d9e6e1dad4c3af5a7e57a03
parent0b6b4f2d195f8224e19b66e5c266a7fd798f321d (diff)
downloadandroid_development-5bad48a65e4f5b69002ac82505598c0adb4ebb35.tar.gz
android_development-5bad48a65e4f5b69002ac82505598c0adb4ebb35.tar.bz2
android_development-5bad48a65e4f5b69002ac82505598c0adb4ebb35.zip
EmuGL: handle NULL data in glBufferData
The data pointer argument to glBufferData can be NULL; this [re]allocates the buffer while leaving the contents undefined. Bug: 5833436 Change-Id: Ia1ddf62e2cd2c59d3d631e01d23d7c557ca5a52e
-rw-r--r--tools/emulator/opengl/host/libs/Translator/GLcommon/GLESbuffer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/emulator/opengl/host/libs/Translator/GLcommon/GLESbuffer.cpp b/tools/emulator/opengl/host/libs/Translator/GLcommon/GLESbuffer.cpp
index b055cc7c0..5dcdd6564 100644
--- a/tools/emulator/opengl/host/libs/Translator/GLcommon/GLESbuffer.cpp
+++ b/tools/emulator/opengl/host/libs/Translator/GLcommon/GLESbuffer.cpp
@@ -25,7 +25,9 @@ bool GLESbuffer::setBuffer(GLuint size,GLuint usage,const GLvoid* data) {
}
m_data = new unsigned char[size];
if(m_data) {
- memcpy(m_data,data,size);
+ if(data) {
+ memcpy(m_data,data,size);
+ }
m_conversionManager.clear();
m_conversionManager.addRange(Range(0,m_size));
return true;