Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2528243002: Fix silent truncations when extracting values from CheckedNumeric (Closed)
Patch Set: compile fix Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.cc ('k') | media/base/video_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f5c727b59b771e90241d6f547fb73fc309cbf941..239e210d688836e782bf1605f6c76bdebb3975df 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -8052,8 +8052,10 @@ void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM(
"the width or height of src region overflow");
return;
}
- src_width = std::abs(src_width_temp.ValueOrDefault(0));
- src_height = std::abs(src_height_temp.ValueOrDefault(0));
+ if (!src_width_temp.Abs().AssignIfValid(&src_width))
+ src_width = 0;
+ if (!src_height_temp.Abs().AssignIfValid(&src_height))
+ src_height = 0;
gfx::Rect src_region(src_x, src_y, src_width, src_height);
if (!src_bounds.Contains(src_region) &&
@@ -8088,8 +8090,10 @@ void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM(
"the width or height of dst region overflow");
return;
}
- dst_width = std::abs(dst_width_temp.ValueOrDefault(0));
- dst_height = std::abs(dst_height_temp.ValueOrDefault(0));
+ if (!dst_width_temp.Abs().AssignIfValid(&dst_width))
+ dst_width = 0;
+ if (!dst_height_temp.Abs().AssignIfValid(&dst_height))
+ dst_height = 0;
GLfloat dst_mapping_width =
static_cast<GLfloat>(src_real_width) * dst_width / src_width;
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.cc ('k') | media/base/video_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698