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

Side by Side Diff: runtime/vm/debugger.cc

Issue 1151263004: Fix use-after-free deleting from linked list. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/debugger.h" 5 #include "vm/debugger.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after
2802 } 2802 }
2803 return; 2803 return;
2804 } 2804 }
2805 2805
2806 prev_bpt = curr_bpt; 2806 prev_bpt = curr_bpt;
2807 curr_bpt = curr_bpt->next(); 2807 curr_bpt = curr_bpt->next();
2808 } 2808 }
2809 2809
2810 if (curr_loc->breakpoints() == NULL) { 2810 if (curr_loc->breakpoints() == NULL) {
2811 if (prev_loc == NULL) { 2811 if (prev_loc == NULL) {
2812 breakpoint_locations_ = breakpoint_locations_->next(); 2812 breakpoint_locations_ = curr_loc->next();
2813 } else { 2813 } else {
2814 prev_loc->set_next(curr_loc->next()); 2814 prev_loc->set_next(curr_loc->next());
2815 } 2815 }
2816 2816
2817 // Remove references from code breakpoints to this source breakpoint, 2817 // Remove references from code breakpoints to this source breakpoint,
2818 // and disable the code breakpoints. 2818 // and disable the code breakpoints.
2819 UnlinkCodeBreakpoints(curr_loc); 2819 UnlinkCodeBreakpoints(curr_loc);
2820 BreakpointLocation* next_loc = curr_loc->next();
2820 delete curr_loc; 2821 delete curr_loc;
2822 curr_loc = next_loc;
2823 } else {
2824 prev_loc = curr_loc;
2825 curr_loc = curr_loc->next();
2821 } 2826 }
2822
2823 prev_loc = curr_loc;
2824 curr_loc = curr_loc->next();
2825 } 2827 }
2826 // bpt is not a registered breakpoint, nothing to do. 2828 // bpt is not a registered breakpoint, nothing to do.
2827 } 2829 }
2828 2830
2829 2831
2830 // Turn code breakpoints associated with the given source breakpoint into 2832 // Turn code breakpoints associated with the given source breakpoint into
2831 // internal breakpoints. They will later be deleted when control 2833 // internal breakpoints. They will later be deleted when control
2832 // returns from the user-defined breakpoint callback. Also, disable the 2834 // returns from the user-defined breakpoint callback. Also, disable the
2833 // breakpoint so it no longer fires if it should be hit before it gets 2835 // breakpoint so it no longer fires if it should be hit before it gets
2834 // deleted. 2836 // deleted.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2924 } 2926 }
2925 2927
2926 2928
2927 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 2929 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
2928 ASSERT(bpt->next() == NULL); 2930 ASSERT(bpt->next() == NULL);
2929 bpt->set_next(code_breakpoints_); 2931 bpt->set_next(code_breakpoints_);
2930 code_breakpoints_ = bpt; 2932 code_breakpoints_ = bpt;
2931 } 2933 }
2932 2934
2933 } // namespace dart 2935 } // namespace dart
OLDNEW
« 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