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

Unified Diff: base/hash.cc

Issue 1916193003: Change SuperFastHash signature to use size_t, not int. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « base/hash.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/hash.cc
diff --git a/base/hash.cc b/base/hash.cc
index d3206f6a6c9cc916e0b388ea5ee1931bcdb68e8f..2f01825928981eb4ef49cceb412f46607a80406e 100644
--- a/base/hash.cc
+++ b/base/hash.cc
@@ -11,8 +11,12 @@ extern "C" uint32_t SuperFastHash(const char* data, int len);
namespace base {
-uint32_t SuperFastHash(const char* data, int len) {
- return ::SuperFastHash(data, len);
+uint32_t SuperFastHash(const char* data, size_t length) {
+ if (length > static_cast<size_t>(std::numeric_limits<int>::max())) {
+ NOTREACHED();
+ return 0;
+ }
+ return ::SuperFastHash(data, static_cast<int>(length));
}
} // namespace base
« no previous file with comments | « base/hash.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698