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

Unified Diff: media/base/video_util.cc

Issue 2528243002: Fix silent truncations when extracting values from CheckedNumeric (Closed)
Patch Set: fixes 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: media/base/video_util.cc
diff --git a/media/base/video_util.cc b/media/base/video_util.cc
index f7fd47ae84b357ee20be86b401cec3fe7d8396a1..d77b0084355c37a32c3e77a24b082c4c34e1aa02 100644
--- a/media/base/video_util.cc
+++ b/media/base/video_util.cc
@@ -270,7 +270,7 @@ static int RoundedDivision(int64_t a, int b) {
base::CheckedNumeric<uint64_t> result(a);
result += b / 2;
result /= b;
- return base::checked_cast<int>(result.ValueOrDie());
+ return base::ValueOrDieForType<int>(result);
}
// Common logic for the letterboxing and scale-within/scale-encompassing

Powered by Google App Engine
This is Rietveld 408576698