aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormkrebs@chromium.org <mkrebs@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-11-14 22:01:35 +0000
committermkrebs@chromium.org <mkrebs@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-11-14 22:01:35 +0000
commit1b75bf9f8a64f6d56c7631ac4bfb4d8f6aeaadb5 (patch)
treec73157089538306fffdd84b2c0578b22e46c3b6f
parentFix typo from r1079. (diff)
downloadbreakpad-1b75bf9f8a64f6d56c7631ac4bfb4d8f6aeaadb5.tar.xz
Fix assertion failure in WriteMappings() for zero modules
If there were no mappings where ShouldIncludeMapping() returned true, AllocateObjectAndArray() would die with an assertion failure. BUG=chrome-os-partner:14914 TEST=Ran unittests Review URL: https://breakpad.appspot.com/492002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1081 4c0a9323-5329-0410-9bdc-e9ce6186880e
-rw-r--r--src/client/linux/minidump_writer/minidump_writer.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc
index 73161628..9fb40358 100644
--- a/src/client/linux/minidump_writer/minidump_writer.cc
+++ b/src/client/linux/minidump_writer/minidump_writer.cc
@@ -834,8 +834,15 @@ class MinidumpWriter {
}
TypedMDRVA<uint32_t> list(&minidump_writer_);
- if (!list.AllocateObjectAndArray(num_output_mappings, MD_MODULE_SIZE))
- return false;
+ if (num_output_mappings) {
+ if (!list.AllocateObjectAndArray(num_output_mappings, MD_MODULE_SIZE))
+ return false;
+ } else {
+ // Still create the module list stream, although it will have zero
+ // modules.
+ if (!list.Allocate())
+ return false;
+ }
dirent->stream_type = MD_MODULE_LIST_STREAM;
dirent->location = list.location();