| 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 c427a9e68bc11d62938e63cb37aa1b06520587a0..a92d7b0ef8b67ff99ad12cc42395c7e5b094a98b 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);
|
|
|