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
This commit is contained in:
parent
df33e47bb4
commit
be55cc8cf0
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user