From 3563b7095a8f52de9d8cbbf55019ec7358492b1e Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Tue, 24 Jun 2014 09:37:51 +0000 Subject: [PATCH] Fix a potential overflow in SortedListBSearch R=yangguo@chromium.org Review URL: https://codereview.chromium.org/344513004 Patch from Jianghua Yang . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21960 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/list-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/list-inl.h b/src/list-inl.h index 8a4cf5670..fd1050ee3 100644 --- a/src/list-inl.h +++ b/src/list-inl.h @@ -219,7 +219,7 @@ int SortedListBSearch(const List& list, P cmp) { int low = 0; int high = list.length() - 1; while (low <= high) { - int mid = (low + high) / 2; + int mid = low + (high - low) / 2; T mid_elem = list[mid]; if (cmp(&mid_elem) > 0) { -- 2.34.1