summaryrefslogtreecommitdiffstats
path: root/opengl/system
diff options
context:
space:
mode:
authorbohu <bohu@google.com>2014-10-17 11:41:52 -0700
committerbohu <bohu@google.com>2014-10-17 11:41:52 -0700
commit4aad46d9e3791353a0d89a1b93879cee0cbb880a (patch)
treec3f8f5ccf5523f9545c0bfd44d391a22954489d6 /opengl/system
parent9c6d37269b85c41203a2f061958922315d55f6ce (diff)
downloadandroid_device_generic_goldfish-4aad46d9e3791353a0d89a1b93879cee0cbb880a.tar.gz
android_device_generic_goldfish-4aad46d9e3791353a0d89a1b93879cee0cbb880a.tar.bz2
android_device_generic_goldfish-4aad46d9e3791353a0d89a1b93879cee0cbb880a.zip
Allow glGetProgramInfoLog_enc to have empty length
OpenGL standard allows empty length parameter and we should handle it properly to avoid crashing emulator. Change-Id: I07c1f726ee9d789fcba53986b724b8f4a1f07cf2
Diffstat (limited to 'opengl/system')
-rw-r--r--opengl/system/GLESv2_enc/gl2_enc.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/opengl/system/GLESv2_enc/gl2_enc.cpp b/opengl/system/GLESv2_enc/gl2_enc.cpp
index 46684e9..8baa289 100644
--- a/opengl/system/GLESv2_enc/gl2_enc.cpp
+++ b/opengl/system/GLESv2_enc/gl2_enc.cpp
@@ -1162,7 +1162,7 @@ void glGetProgramInfoLog_enc(void *self , GLuint program, GLsizei bufsize, GLsiz
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
- const unsigned int __size_length = sizeof(GLsizei);
+ const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
const unsigned int __size_infolog = bufsize;
unsigned char *ptr;
const size_t packetSize = 8 + 4 + 4 + __size_length + __size_infolog + 2*4;
@@ -1174,7 +1174,7 @@ void glGetProgramInfoLog_enc(void *self , GLuint program, GLsizei bufsize, GLsiz
memcpy(ptr, &bufsize, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_length; ptr += 4;
*(unsigned int *)(ptr) = __size_infolog; ptr += 4;
- stream->readback(length, __size_length);
+ if (length != NULL) stream->readback(length, __size_length);
stream->readback(infolog, __size_infolog);
}