diff --git a/minidump/minidump_file_writer.cc b/minidump/minidump_file_writer.cc index 4ee1bd07..8e67db06 100644 --- a/minidump/minidump_file_writer.cc +++ b/minidump/minidump_file_writer.cc @@ -150,8 +150,8 @@ bool MinidumpFileWriter::WriteObject(FileWriterInterface* file_writer) { std::vector iovecs(1, iov); for (internal::MinidumpStreamWriter* stream : streams_) { - iov.iov_len = sizeof(MINIDUMP_DIRECTORY); iov.iov_base = stream->DirectoryListEntry(); + iov.iov_len = sizeof(MINIDUMP_DIRECTORY); iovecs.push_back(iov); } diff --git a/minidump/minidump_memory_writer.cc b/minidump/minidump_memory_writer.cc index cd8d33e4..5857dbcf 100644 --- a/minidump/minidump_memory_writer.cc +++ b/minidump/minidump_memory_writer.cc @@ -163,8 +163,8 @@ bool MinidumpMemoryListWriter::WriteObject(FileWriterInterface* file_writer) { std::vector iovecs(1, iov); for (const MinidumpMemoryWriter* memory_writer : memory_writers_) { - iov.iov_len = sizeof(MINIDUMP_MEMORY_DESCRIPTOR); iov.iov_base = memory_writer->MinidumpMemoryDescriptor(); + iov.iov_len = sizeof(MINIDUMP_MEMORY_DESCRIPTOR); iovecs.push_back(iov); } diff --git a/minidump/minidump_module_writer.cc b/minidump/minidump_module_writer.cc index d674760f..76521554 100644 --- a/minidump/minidump_module_writer.cc +++ b/minidump/minidump_module_writer.cc @@ -154,7 +154,6 @@ bool MinidumpModuleMiscDebugRecordWriter::WriteObject( iov.iov_len = base_length; std::vector iovecs(1, iov); - iov.iov_len = image_debug_misc_.Length - base_length; if (!image_debug_misc_.Unicode) { DCHECK(data_utf16_.empty()); iov.iov_base = &data_[0]; @@ -162,6 +161,7 @@ bool MinidumpModuleMiscDebugRecordWriter::WriteObject( DCHECK(data_.empty()); iov.iov_base = &data_utf16_[0]; } + iov.iov_len = image_debug_misc_.Length - base_length; iovecs.push_back(iov); return file_writer->WriteIoVec(&iovecs); @@ -358,8 +358,8 @@ bool MinidumpModuleListWriter::WriteObject(FileWriterInterface* file_writer) { std::vector iovecs(1, iov); for (const MinidumpModuleWriter* module : modules_) { - iov.iov_len = sizeof(MINIDUMP_MODULE); iov.iov_base = module->MinidumpModule(); + iov.iov_len = sizeof(MINIDUMP_MODULE); iovecs.push_back(iov); } diff --git a/minidump/minidump_simple_string_dictionary_writer.cc b/minidump/minidump_simple_string_dictionary_writer.cc index d9a5c919..0b47cf8b 100644 --- a/minidump/minidump_simple_string_dictionary_writer.cc +++ b/minidump/minidump_simple_string_dictionary_writer.cc @@ -144,12 +144,10 @@ bool MinidumpSimpleStringDictionaryWriter::WriteObject( iov.iov_len = sizeof(simple_string_dictionary_base_); std::vector iovecs(1, iov); - if (!entries_.empty()) { + for (const auto& key_entry : entries_) { + iov.iov_base = key_entry.second->MinidumpSimpleStringDictionaryEntry(); iov.iov_len = sizeof(MinidumpSimpleStringDictionaryEntry); - for (const auto& key_entry : entries_) { - iov.iov_base = key_entry.second->MinidumpSimpleStringDictionaryEntry(); - iovecs.push_back(iov); - } + iovecs.push_back(iov); } return file_writer->WriteIoVec(&iovecs); diff --git a/minidump/minidump_thread_writer.cc b/minidump/minidump_thread_writer.cc index 8f0e0856..e2392322 100644 --- a/minidump/minidump_thread_writer.cc +++ b/minidump/minidump_thread_writer.cc @@ -164,8 +164,8 @@ bool MinidumpThreadListWriter::WriteObject(FileWriterInterface* file_writer) { std::vector iovecs(1, iov); for (const MinidumpThreadWriter* thread : threads_) { - iov.iov_len = sizeof(MINIDUMP_THREAD); iov.iov_base = thread->MinidumpThread(); + iov.iov_len = sizeof(MINIDUMP_THREAD); iovecs.push_back(iov); }