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

Side by Side Diff: chrome/browser/extensions/api/sessions/sessions_api.cc

Issue 186343003: Fix index out of bounds bug which causes memory leak or browser crash in extension sessions API. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/sessions/sessions_api.h" 5 #include "chrome/browser/extensions/api/sessions/sessions_api.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return true; 222 return true;
223 } 223 }
224 224
225 scoped_ptr<tabs::Tab> SessionsGetDevicesFunction::CreateTabModel( 225 scoped_ptr<tabs::Tab> SessionsGetDevicesFunction::CreateTabModel(
226 const std::string& session_tag, 226 const std::string& session_tag,
227 const SessionTab& tab, 227 const SessionTab& tab,
228 int tab_index, 228 int tab_index,
229 int selected_index) { 229 int selected_index) {
230 std::string session_id = SessionId(session_tag, tab.tab_id.id()).ToString(); 230 std::string session_id = SessionId(session_tag, tab.tab_id.id()).ToString();
231 return CreateTabModelHelper(GetProfile(), 231 return CreateTabModelHelper(GetProfile(),
232 tab.navigations[tab.current_navigation_index], 232 tab.navigations[
233 tab.normalized_navigation_index()],
233 session_id, 234 session_id,
234 tab_index, 235 tab_index,
235 tab.pinned, 236 tab.pinned,
236 selected_index, 237 selected_index,
237 GetExtension()); 238 GetExtension());
238 } 239 }
239 240
240 scoped_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel( 241 scoped_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel(
241 const SessionWindow& window, const std::string& session_tag) { 242 const SessionWindow& window, const std::string& session_tag) {
242 DCHECK(!window.tabs.empty()); 243 DCHECK(!window.tabs.empty());
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 SetInvalidIdError(*params->session_id); 571 SetInvalidIdError(*params->session_id);
571 return false; 572 return false;
572 } 573 }
573 574
574 return session_id->IsForeign() ? 575 return session_id->IsForeign() ?
575 RestoreForeignSession(*session_id, browser) 576 RestoreForeignSession(*session_id, browser)
576 : RestoreLocalSession(*session_id, browser); 577 : RestoreLocalSession(*session_id, browser);
577 } 578 }
578 579
579 } // namespace extensions 580 } // namespace extensions
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698