| 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 1d366022bbbf05cdc616133fdaf42eacefb51552..2f02ee210cdadc8b31e0e86261a4d9e54280106d 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| @@ -6945,11 +6945,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");
|
| @@ -7029,7 +7035,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);
|
|
|