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

Side by Side Diff: src/client/linux/minidump_writer/minidump_writer.cc

Issue 1959643004: Fix stack collection with size limit (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Created 4 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) 2010, Google Inc. 1 // Copyright (c) 2010, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 bool FillThreadStack(MDRawThread* thread, uintptr_t stack_pointer, 268 bool FillThreadStack(MDRawThread* thread, uintptr_t stack_pointer,
269 int max_stack_len, uint8_t** stack_copy) { 269 int max_stack_len, uint8_t** stack_copy) {
270 *stack_copy = NULL; 270 *stack_copy = NULL;
271 const void* stack; 271 const void* stack;
272 size_t stack_len; 272 size_t stack_len;
273 if (dumper_->GetStackInfo(&stack, &stack_len, stack_pointer)) { 273 if (dumper_->GetStackInfo(&stack, &stack_len, stack_pointer)) {
274 UntypedMDRVA memory(&minidump_writer_); 274 UntypedMDRVA memory(&minidump_writer_);
275 if (max_stack_len >= 0 && 275 if (max_stack_len >= 0 &&
276 stack_len > static_cast<unsigned int>(max_stack_len)) { 276 stack_len > static_cast<unsigned int>(max_stack_len)) {
277 stack_len = max_stack_len; 277 stack_len = max_stack_len;
278 // Skip empty chunks of length max_stack_len.
279 uintptr_t int_stack = reinterpret_cast<uintptr_t>(stack);
280 while (int_stack + max_stack_len < stack_pointer) {
ivanpe 2016/05/17 01:03:10 Please, remove the extra blank after '+'
lv 2016/05/23 15:54:57 Done.
281 int_stack += max_stack_len;
ivanpe 2016/05/17 01:03:10 This will be an infinite loop when max_stack_len =
lv 2016/05/23 15:54:57 I added an additional check. I don't think anyone
282 }
283 stack = reinterpret_cast<const void*>(int_stack);
278 } 284 }
279 if (!memory.Allocate(stack_len)) 285 if (!memory.Allocate(stack_len))
280 return false; 286 return false;
281 *stack_copy = reinterpret_cast<uint8_t*>(Alloc(stack_len)); 287 *stack_copy = reinterpret_cast<uint8_t*>(Alloc(stack_len));
282 dumper_->CopyFromProcess(*stack_copy, thread->thread_id, stack, 288 dumper_->CopyFromProcess(*stack_copy, thread->thread_id, stack,
283 stack_len); 289 stack_len);
284 memory.Copy(*stack_copy, stack_len); 290 memory.Copy(*stack_copy, stack_len);
285 thread->stack.start_of_memory_range = 291 thread->stack.start_of_memory_range =
286 reinterpret_cast<uintptr_t>(stack); 292 reinterpret_cast<uintptr_t>(stack);
287 thread->stack.memory = memory.location(); 293 thread->stack.memory = memory.location();
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 const MappingList& mappings, 1366 const MappingList& mappings,
1361 const AppMemoryList& appmem, 1367 const AppMemoryList& appmem,
1362 LinuxDumper* dumper) { 1368 LinuxDumper* dumper) {
1363 MinidumpWriter writer(filename, -1, NULL, mappings, appmem, dumper); 1369 MinidumpWriter writer(filename, -1, NULL, mappings, appmem, dumper);
1364 if (!writer.Init()) 1370 if (!writer.Init())
1365 return false; 1371 return false;
1366 return writer.Dump(); 1372 return writer.Dump();
1367 } 1373 }
1368 1374
1369 } // namespace google_breakpad 1375 } // namespace google_breakpad
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