win: Handle the case when GetBytesBuffer returns error in HTTPTransportWin

HTTPBodyStream::GetBytesBuffer returns negative number on error.

Change-Id: I9958fb35d65e894067d71e8f37c30ff8948cd90d
Reviewed-on: https://chromium-review.googlesource.com/366360
Reviewed-by: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Marcin Grześkowiak 2016-08-05 11:00:38 +02:00 committed by Mark Mentovai
parent 7c807242e0
commit 6f6242865d
2 changed files with 6 additions and 1 deletions

View File

@ -7,3 +7,4 @@
# The email address is not required for organizations.
Google Inc.
Opera Software ASA

View File

@ -179,8 +179,12 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) {
uint8_t buffer[kBufferSize];
FileOperationResult bytes_to_write =
body_stream()->GetBytesBuffer(buffer, sizeof(buffer));
if (bytes_to_write == 0)
if (bytes_to_write == 0) {
break;
} else if (bytes_to_write < 0) {
LOG(ERROR) << "GetBytesBuffer failed";
return false;
}
post_data.insert(post_data.end(), buffer, buffer + bytes_to_write);
}