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

Unified Diff: net/base/upload_data_stream.cc

Issue 6292013: Add chunked uploads support to SPDY (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 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
Index: net/base/upload_data_stream.cc
diff --git a/net/base/upload_data_stream.cc b/net/base/upload_data_stream.cc
index 9f7bdbb419a28d63610b9235c0d5fcd9a6b5952e..81e23c58cc4af662e587e55eaa563110d5e5b1a6 100644
--- a/net/base/upload_data_stream.cc
+++ b/net/base/upload_data_stream.cc
@@ -69,8 +69,13 @@ int UploadDataStream::FillBuf() {
size_t bytes_copied = std::min(count, size_remaining);
- memcpy(buf_->data() + buf_len_, &d[next_element_offset_], bytes_copied);
- buf_len_ += bytes_copied;
+ // Check if we have anything to copy first, because we are getting the
+ // address of an element in |d| and that will throw an exception if |d|
+ // is an empty vector.
+ if (bytes_copied) {
+ memcpy(buf_->data() + buf_len_, &d[next_element_offset_], bytes_copied);
+ buf_len_ += bytes_copied;
+ }
if (bytes_copied == count) {
advance_to_next_element = true;

Powered by Google App Engine
This is Rietveld 408576698