Permalink
Browse files

Another fix for furchash_hphp_ext

Summary: Need to keep the values in range.

Reviewed By: alexeyt

Differential Revision: D7399854

fbshipit-source-id: d41244bfd1fd75aaac72c33d8e245f56d479354a
  • Loading branch information...
markw65 authored and hhvm-bot committed Mar 26, 2018
1 parent d889893 commit 75f137f90ee84145e6a8f21fb661d5a94b9b2328
Showing with 3 additions and 2 deletions.
  1. +3 −2 hphp/runtime/ext/hash/ext_hash.cpp
@@ -38,7 +38,9 @@
#include "hphp/runtime/ext/hash/hash_joaat.h"
#if defined(HPHP_OSS)
#define furc_hash furc_hash_internal
#define furc_hash(a, b, c) furc_hash_internal( \
(a), (b), \
uint64_t(c) > furc_maximum_pool_size() ? furc_maximum_pool_size() : c)
#else
#include "mcrouter/lib/fbi/hash.h" // @nolint
#endif
@@ -436,7 +438,6 @@ bool HHVM_FUNCTION(hash_equals, const Variant& known, const Variant& user) {
int64_t HHVM_FUNCTION(furchash_hphp_ext, const String& key,
int64_t len, int64_t nPart) {
len = std::max<int64_t>(std::min<int64_t>(len, key.size()), 0);
if (nPart > furc_maximum_pool_size()) nPart = furc_maximum_pool_size();
return furc_hash(key.data(), len, nPart);
}

0 comments on commit 75f137f

Please sign in to comment.