diff --git a/hphp/runtime/base/string-util.cpp b/hphp/runtime/base/string-util.cpp index 56d7104c14f987..51408ef85a6453 100644 --- a/hphp/runtime/base/string-util.cpp +++ b/hphp/runtime/base/string-util.cpp @@ -124,8 +124,8 @@ String StringUtil::Implode(const Variant& items, const String& delim, req::vector sitems; sitems.reserve(size); - int len = 0; - int lenDelim = delim.size(); + size_t len = 0; + size_t lenDelim = delim.size(); for (ArrayIter iter(items); iter; ++iter) { sitems.emplace_back(iter.second().toString()); len += sitems.back().size() + lenDelim; diff --git a/hphp/test/slow/string_length_overflow/implode.php b/hphp/test/slow/string_length_overflow/implode.php new file mode 100644 index 00000000000000..3d348321ac4b10 --- /dev/null +++ b/hphp/test/slow/string_length_overflow/implode.php @@ -0,0 +1,5 @@ +