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

Unified Diff: src/objects-inl.h

Issue 1314253006: Fix a potential overflow of binary search (Closed) Base URL: git@github.com:v8/v8-git-mirror.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/list-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 5b3c38e1e2958326a9ecff327c2f7f7227430b88..85b9835417e1619c1321ab1d629154ebcbdc3bb1 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2784,7 +2784,7 @@ int BinarySearch(T* array, Name* name, int low, int high, int valid_entries,
DCHECK(low <= high);
while (low != high) {
- int mid = (low + high) / 2;
+ int mid = low + (high - low) / 2;
Name* mid_name = array->GetSortedKey(mid);
uint32_t mid_hash = mid_name->Hash();
« no previous file with comments | « src/list-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698