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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp

Issue 2232083002: Fix incorrect usage of StringImpl::sizeInBytes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: size_teeee Created 4 years, 4 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
Index: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp
index edb2fcdc7d333d4f46a0c2cdb91979f97421279c..aedaade5fd00215a23c71dd9c91a4bf04ec197e9 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp
@@ -37,16 +37,17 @@ static String16 calculateHash(const String16& str)
size_t current = 0;
const uint32_t* data = nullptr;
data = reinterpret_cast<const uint32_t*>(str.characters16());
- for (size_t i = 0; i < str.sizeInBytes() / 4; i += 4) {
+ size_t charactersSizeInBytes = str.charactersSizeInBytes();
+ for (size_t i = 0; i < charactersSizeInBytes / 4; i += 4) {
uint32_t v = data[i];
uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF;
hashes[current] = (hashes[current] + zi[current] * xi) % prime[current];
zi[current] = (zi[current] * random[current]) % prime[current];
current = current == hashesSize - 1 ? 0 : current + 1;
}
- if (str.sizeInBytes() % 4) {
+ if (charactersSizeInBytes % 4) {
uint32_t v = 0;
- for (size_t i = str.sizeInBytes() - str.sizeInBytes() % 4; i < str.sizeInBytes(); ++i) {
+ for (size_t i = charactersSizeInBytes - charactersSizeInBytes % 4; i < charactersSizeInBytes; ++i) {
v <<= 8;
v |= reinterpret_cast<const uint8_t*>(data)[i];
}
« no previous file with comments | « third_party/WebKit/Source/platform/inspector_protocol/String16WTF.h ('k') | third_party/WebKit/Source/wtf/text/AtomicString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698