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

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

Issue 2528243002: Fix silent truncations when extracting values from CheckedNumeric (Closed)
Patch Set: compile cleanup and fix Created 4 years, 1 month 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
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 3c0f126881452c0bd00de777adffe0901a3d2aa6..0d8cd410ab51c80e3a1bdb8733467a74b9c51821 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -8017,8 +8017,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) &&
@@ -8053,8 +8055,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;

Powered by Google App Engine
This is Rietveld 408576698