Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index ec5b2abd19fde36ab46ebf8054cd5a048e70db81..545c4c77b74c6fc6e19753fcc603805a7fccbb17 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -6947,11 +6947,17 @@ error::Error GLES2DecoderImpl::HandleReadPixels( |
} |
void* pixels = GetSharedMemoryAs<void*>( |
c.pixels_shm_id, c.pixels_shm_offset, pixels_size); |
- Result* result = GetSharedMemoryAs<Result*>( |
- c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
- if (!pixels || !result) { |
+ if (!pixels) { |
return error::kOutOfBounds; |
} |
+ Result* result = NULL; |
+ if (c.result_shm_id != 0) { |
+ result = GetSharedMemoryAs<Result*>( |
+ c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
+ if (!result) { |
+ return error::kOutOfBounds; |
+ } |
+ } |
if (!validators_->read_pixel_format.IsValid(format)) { |
LOCAL_SET_GL_ERROR_INVALID_ENUM("glReadPixels", format, "format"); |
@@ -7031,7 +7037,9 @@ error::Error GLES2DecoderImpl::HandleReadPixels( |
} |
GLenum error = LOCAL_PEEK_GL_ERROR("glReadPixels"); |
if (error == GL_NO_ERROR) { |
- *result = true; |
+ if (result != NULL) { |
+ *result = true; |
+ } |
GLenum read_format = GetBoundReadFrameBufferInternalFormat(); |
uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); |