| Index: webrtc/base/helpers.cc
|
| diff --git a/webrtc/base/helpers.cc b/webrtc/base/helpers.cc
|
| index b284cd7a73237b5c4608cd4dd7187c79d4029ed4..0eaf57b079f6dff344286419c955778c1ac45571 100644
|
| --- a/webrtc/base/helpers.cc
|
| +++ b/webrtc/base/helpers.cc
|
| @@ -219,10 +219,15 @@ std::string CreateRandomString(size_t len) {
|
| return str;
|
| }
|
|
|
| -bool CreateRandomString(size_t len,
|
| +static bool CreateRandomString(size_t len,
|
| const char* table, int table_size,
|
| std::string* str) {
|
| str->clear();
|
| + // Avoid biased modulo division below.
|
| + if (256 % table_size) {
|
| + LOG(LS_ERROR) << "Table size must divide 256 evenly!";
|
| + return false;
|
| + }
|
| std::unique_ptr<uint8_t[]> bytes(new uint8_t[len]);
|
| if (!Rng().Generate(bytes.get(), len)) {
|
| LOG(LS_ERROR) << "Failed to generate random string!";
|
|
|