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

Unified Diff: src/objects-inl.h

Issue 417353002: Fix a potential overflow in BinarySearch, same as Issue 344513004 (Closed) Base URL: https://github.com/v8/v8.git@master
Patch Set: Created 6 years, 5 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 | « no previous file | 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 83c81690e1ce4191305c150a80696c41b49c80af..6191fe0daa14543f203e6eb5f71331d1393ff63e 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2765,7 +2765,7 @@ int BinarySearch(T* array, Name* name, int low, int high, int valid_entries) {
ASSERT(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 | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698