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

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

Issue 2528243002: Fix silent truncations when extracting values from CheckedNumeric (Closed)
Patch Set: pointer math tests 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
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 46dc8961d05d4aeb10b72cdd9b1fe1e984276946..a7cd9e7168be0f2be70f1bc60256fbb772bf99f2 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -8024,8 +8024,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) &&
@@ -8060,8 +8062,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