aboutsummaryrefslogtreecommitdiff
path: root/src/client/linux/minidump_writer
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org>2015-01-27 03:27:08 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org>2015-01-27 03:27:08 +0000
commitcfaf27c37e3e5df5ca00a75758a36af870b5fb45 (patch)
tree9b791cae86c65c317c76484cbe3513f209f7f4e8 /src/client/linux/minidump_writer
parentFix some fragile code that is likely to cause future memory corruption (diff)
downloadbreakpad-cfaf27c37e3e5df5ca00a75758a36af870b5fb45.tar.xz
Stop calling memmove when unnecessary
BUG=chromium:450137 R=mark@chromium.org git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1416 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/linux/minidump_writer')
-rw-r--r--src/client/linux/minidump_writer/linux_ptrace_dumper.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
index 5ab59c27..95f12942 100644
--- a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
@@ -282,8 +282,10 @@ bool LinuxPtraceDumper::ThreadsSuspend() {
// If the thread either disappeared before we could attach to it, or if
// it was part of the seccomp sandbox's trusted code, it is OK to
// silently drop it from the minidump.
- my_memmove(&threads_[i], &threads_[i+1],
- (threads_.size() - i - 1) * sizeof(threads_[i]));
+ if (i < threads_.size() - 1) {
+ my_memmove(&threads_[i], &threads_[i + 1],
+ (threads_.size() - i - 1) * sizeof(threads_[i]));
+ }
threads_.resize(threads_.size() - 1);
--i;
}