diff options
author | mmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2011-07-01 01:20:27 +0000 |
---|---|---|
committer | mmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2011-07-01 01:20:27 +0000 |
commit | be55cc8cf05aace5e8769230e02b5948a0079496 (patch) | |
tree | fd6132c1770de6cfc2664f3f8c742235f84b02dc | |
parent | Delete OS failing test cases and note failure in relevant .h file. (diff) | |
download | breakpad-be55cc8cf05aace5e8769230e02b5948a0079496.tar.xz |
Fix an assertion encountered in UntypedMDRVA::Copy().
Fix an assertion where a zero-length buffer was being passed to
UntypedMDRVA::Copy(). This occurred when WriteFile() was given a file whose
size was a multiple of the temporary buffer size. In this issue's case, the
procfs file "environ" happened to be 2032 bytes, while the temporary buffer
was 1016 bytes.
Patch by Michael Krebs <mkrebs@chromium.org>
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@792 4c0a9323-5329-0410-9bdc-e9ce6186880e
-rw-r--r-- | src/client/linux/minidump_writer/minidump_writer.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc index ee9adac0..77ff7ea2 100644 --- a/src/client/linux/minidump_writer/minidump_writer.cc +++ b/src/client/linux/minidump_writer/minidump_writer.cc @@ -1212,6 +1212,15 @@ class MinidumpWriter { if (!memory.Allocate(total)) return false; for (MDRVA pos = memory.position(); buffers; buffers = buffers->next) { + // Check for special case of a zero-length buffer. This should only + // occur if a file's size happens to be a multiple of the buffer's + // size, in which case the final sys_read() will have resulted in + // zero bytes being read after the final buffer was just allocated. + if (buffers->len == 0) { + // This can only occur with final buffer. + assert(buffers->next == NULL); + continue; + } memory.Copy(pos, &buffers->data, buffers->len); pos += buffers->len; } |