Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: minidump/minidump_string_writer.cc

Issue 896663006: win: Resolve zero-length array errors on MSVC (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@minidump-comp
Patch Set: fixes Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « minidump/minidump_string_writer.h ('k') | minidump/minidump_thread_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: minidump/minidump_string_writer.cc
diff --git a/minidump/minidump_string_writer.cc b/minidump/minidump_string_writer.cc
index eea4eec46a12200b7120071b41dfe24e849c33e5..95c0ad59b7002ae80019bb8204ed9db3d0625d25 100644
--- a/minidump/minidump_string_writer.cc
+++ b/minidump/minidump_string_writer.cc
@@ -26,7 +26,7 @@ namespace internal {
template <typename Traits>
MinidumpStringWriter<Traits>::MinidumpStringWriter()
- : MinidumpWritable(), string_base_(), string_() {
+ : MinidumpWritable(), string_base_(new MinidumpStringType()), string_() {
}
template <typename Traits>
@@ -42,7 +42,7 @@ bool MinidumpStringWriter<Traits>::Freeze() {
}
size_t string_bytes = string_.size() * sizeof(string_[0]);
- if (!AssignIfInRange(&string_base_.Length, string_bytes)) {
+ if (!AssignIfInRange(&string_base_->Length, string_bytes)) {
LOG(ERROR) << "string_bytes " << string_bytes << " out of range";
return false;
}
@@ -55,7 +55,7 @@ size_t MinidumpStringWriter<Traits>::SizeOfObject() {
DCHECK_GE(state(), kStateFrozen);
// Include the NUL terminator.
- return sizeof(string_base_) + (string_.size() + 1) * sizeof(string_[0]);
+ return sizeof(*string_base_) + (string_.size() + 1) * sizeof(string_[0]);
}
template <typename Traits>
@@ -66,8 +66,8 @@ bool MinidumpStringWriter<Traits>::WriteObject(
// The string’s length is stored in string_base_, and its data is stored in
// string_. Write them both.
WritableIoVec iov;
- iov.iov_base = &string_base_;
- iov.iov_len = sizeof(string_base_);
+ iov.iov_base = string_base_.get();
+ iov.iov_len = sizeof(*string_base_);
std::vector<WritableIoVec> iovecs(1, iov);
// Include the NUL terminator.
« no previous file with comments | « minidump/minidump_string_writer.h ('k') | minidump/minidump_thread_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698