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

Issue 2225933004: Avoid adding invalid headers in AddHeaderFromString (Closed)

Created:
4 years, 4 months ago by Adam Rice
Modified:
4 years, 4 months ago
Reviewers:
mmenke
CC:
chromium-reviews, cbentzel+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Avoid adding invalid headers in AddHeaderFromString In net::HttpRequestHeaders::AddHeaderFromString(), verify that the header name and value are valid. If they are not, don't add them (and log a fatal message on debug builds). BUG=634225 Committed: https://crrev.com/0753a6f4ffdb5bcd1ff9c4b977f9052878112f42 Cr-Commit-Position: refs/heads/master@{#411556}

Patch Set 1 #

Total comments: 8

Patch Set 2 : Move anonymous namespace. Use string.empty(). #

Patch Set 3 : Protect against off-the-end iterators. #

Patch Set 4 : Remove IsToken(iterator, iterator) overload #

Total comments: 2

Patch Set 5 : Fix bug in HttpContentDisposition::ConsumeDispositionType #

Patch Set 6 : Use StringPiece in HttpContentDisposition::ConsumeDispositionType #

Patch Set 7 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+70 lines, -49 lines) Patch
M net/http/http_content_disposition.cc View 1 2 3 4 2 chunks +10 lines, -12 lines 0 comments Download
M net/http/http_request_headers.h View 1 chunk +2 lines, -0 lines 0 comments Download
M net/http/http_request_headers.cc View 1 chunk +11 lines, -15 lines 0 comments Download
M net/http/http_util.h View 1 2 3 3 chunks +5 lines, -7 lines 0 comments Download
M net/http/http_util.cc View 1 2 3 4 5 chunks +35 lines, -15 lines 0 comments Download
M net/http/http_util_unittest.cc View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 26 (16 generated)
Adam Rice
+mmenke We won't want this if we're going to eliminate AddHeaderFromString() altogether. But it looks ...
4 years, 4 months ago (2016-08-09 11:10:16 UTC) #4
mmenke
https://codereview.chromium.org/2225933004/diff/1/net/http/http_util.cc File net/http/http_util.cc (right): https://codereview.chromium.org/2225933004/diff/1/net/http/http_util.cc#newcode427 net/http/http_util.cc:427: } // namespace The more common pattern in net/ ...
4 years, 4 months ago (2016-08-09 16:54:47 UTC) #7
Adam Rice
https://codereview.chromium.org/2225933004/diff/1/net/http/http_util.cc File net/http/http_util.cc (right): https://codereview.chromium.org/2225933004/diff/1/net/http/http_util.cc#newcode427 net/http/http_util.cc:427: } // namespace On 2016/08/09 16:54:47, mmenke wrote: > ...
4 years, 4 months ago (2016-08-10 03:19:08 UTC) #10
mmenke
https://codereview.chromium.org/2225933004/diff/1/net/http/http_util.h File net/http/http_util.h (right): https://codereview.chromium.org/2225933004/diff/1/net/http/http_util.h#newcode120 net/http/http_util.h:120: return IsToken(base::StringPiece(&*begin, end - begin)); On 2016/08/10 03:19:07, Adam ...
4 years, 4 months ago (2016-08-10 03:30:55 UTC) #11
Adam Rice
https://codereview.chromium.org/2225933004/diff/1/net/http/http_util.h File net/http/http_util.h (right): https://codereview.chromium.org/2225933004/diff/1/net/http/http_util.h#newcode120 net/http/http_util.h:120: return IsToken(base::StringPiece(&*begin, end - begin)); On 2016/08/10 03:30:55, mmenke ...
4 years, 4 months ago (2016-08-10 05:22:59 UTC) #14
mmenke
LGTM, moduloe comment. Not going to ask you to convert anything else over to StringPieces, ...
4 years, 4 months ago (2016-08-10 20:15:19 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2225933004/120001
4 years, 4 months ago (2016-08-12 04:20:05 UTC) #22
commit-bot: I haz the power
Committed patchset #7 (id:120001)
4 years, 4 months ago (2016-08-12 05:21:14 UTC) #23
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/0753a6f4ffdb5bcd1ff9c4b977f9052878112f42 Cr-Commit-Position: refs/heads/master@{#411556}
4 years, 4 months ago (2016-08-12 05:22:44 UTC) #25
Adam Rice
4 years, 4 months ago (2016-08-12 05:48:33 UTC) #26
Message was sent while issue was closed.
https://codereview.chromium.org/2225933004/diff/60001/net/http/http_content_d...
File net/http/http_content_disposition.cc (right):

https://codereview.chromium.org/2225933004/diff/60001/net/http/http_content_d...
net/http/http_content_disposition.cc:352: HttpUtil::TrimLWS(&type_begin,
&type_end);
On 2016/08/10 20:15:19, mmenke wrote:
> There's a base::StringPiece version of this, too.  Can go back beyond that
> without running into HttpContentDisposition::Parse, unfortuantely, which has
> multiple callsites, and goes a bit beyond the scope of this CL.

Done.

HttpUtil::HeadersIterator can be cleaned up similarly, but it would be cleanest
to change HttpResponseHeaders at the same time, and this CL has seen enough
scope creep.

Powered by Google App Engine
This is Rietveld 408576698