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

Unified Diff: headless/public/util/generic_url_request_job.cc

Issue 2854973004: Add extra size check to avoid unwanted Seg Fault (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/public/util/generic_url_request_job.cc
diff --git a/headless/public/util/generic_url_request_job.cc b/headless/public/util/generic_url_request_job.cc
index 4cf9bdd257cff27157b88b9279bd6988f9b5083d..779f74461769a649f4d991456408d2ae5f36bf2a 100644
--- a/headless/public/util/generic_url_request_job.cc
+++ b/headless/public/util/generic_url_request_job.cc
@@ -276,6 +276,9 @@ std::string GenericURLRequestJob::GetPostData() const {
if (!stream->GetElementReaders())
return "";
+ if (stream->GetElementReaders()->size() == 0)
+ return "";
+
DCHECK_EQ(1u, stream->GetElementReaders()->size());
const net::UploadBytesElementReader* reader =
(*stream->GetElementReaders())[0]->AsBytesReader();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698