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

Unified Diff: unit_test/unit_test.h

Issue 1662453003: fix for ubsan on unittest.h fastrand() (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: Created 4 years, 11 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unit_test/unit_test.h
diff --git a/unit_test/unit_test.h b/unit_test/unit_test.h
index f816ec711ac4dc51be3937ff832f0faaf39840e0..8e600e15e7e28d362451d45321e0510f99f8119f 100644
--- a/unit_test/unit_test.h
+++ b/unit_test/unit_test.h
@@ -57,7 +57,8 @@ static inline double get_time() {
extern int fastrand_seed;
pbos-webrtc 2016/02/02 21:11:47 Just use an unsigned int, then fastrand_seed >> 16
fbarchard1 2016/02/02 22:23:33 Done.
inline int fastrand() {
- fastrand_seed = fastrand_seed * 214013 + 2531011;
+ fastrand_seed = static_cast<int>(
+ static_cast<unsigned int>(fastrand_seed) * 214013u + 2531011u);
return (fastrand_seed >> 16) & 0xffff;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698