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

Side by Side Diff: net/http/http_chunked_decoder.h

Issue 11191003: Fix a crash when a line with an HTTP chunk length is too long (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix signed / unsigned comparison Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Derived from: 5 // Derived from:
6 // mozilla/netwerk/protocol/http/src/nsHttpChunkedDecoder.h 6 // mozilla/netwerk/protocol/http/src/nsHttpChunkedDecoder.h
7 // The license block is: 7 // The license block is:
8 /* ***** BEGIN LICENSE BLOCK ***** 8 /* ***** BEGIN LICENSE BLOCK *****
9 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 9 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
10 * 10 *
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // 70 //
71 // The chunk-size field is a string of hex digits indicating the size of the 71 // The chunk-size field is a string of hex digits indicating the size of the
72 // chunk. The chunked encoding is ended by any chunk whose size is zero, 72 // chunk. The chunked encoding is ended by any chunk whose size is zero,
73 // followed by the trailer, which is terminated by an empty line. 73 // followed by the trailer, which is terminated by an empty line.
74 // 74 //
75 // NOTE: This implementation does not bother to parse trailers since they are 75 // NOTE: This implementation does not bother to parse trailers since they are
76 // not used on the web. 76 // not used on the web.
77 // 77 //
78 class NET_EXPORT_PRIVATE HttpChunkedDecoder { 78 class NET_EXPORT_PRIVATE HttpChunkedDecoder {
79 public: 79 public:
80 // The maximum length of |line_buf_| between calls to FilterBuff().
81 // Exposed for tests.
82 static const size_t kMaxLineBufLen;
83
80 HttpChunkedDecoder(); 84 HttpChunkedDecoder();
81 85
82 // Indicates that a previous call to FilterBuf encountered the final CRLF. 86 // Indicates that a previous call to FilterBuf encountered the final CRLF.
83 bool reached_eof() const { return reached_eof_; } 87 bool reached_eof() const { return reached_eof_; }
84 88
85 // Returns the number of bytes after the final CRLF. 89 // Returns the number of bytes after the final CRLF.
86 int bytes_after_eof() const { return bytes_after_eof_; } 90 int bytes_after_eof() const { return bytes_after_eof_; }
87 91
88 // Called to filter out the chunk markers from buf and to check for end-of- 92 // Called to filter out the chunk markers from buf and to check for end-of-
89 // file. This method modifies |buf| inline if necessary to remove chunk 93 // file. This method modifies |buf| inline if necessary to remove chunk
(...skipping 29 matching lines...) Expand all
119 bool reached_eof_; 123 bool reached_eof_;
120 124
121 // The number of unfiltered bytes after the final CRLF, either extraneous 125 // The number of unfiltered bytes after the final CRLF, either extraneous
122 // data or the first part of the next response in a pipelined stream. 126 // data or the first part of the next response in a pipelined stream.
123 int bytes_after_eof_; 127 int bytes_after_eof_;
124 }; 128 };
125 129
126 } // namespace net 130 } // namespace net
127 131
128 #endif // NET_HTTP_HTTP_CHUNKED_DECODER_H_ 132 #endif // NET_HTTP_HTTP_CHUNKED_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | net/http/http_chunked_decoder.cc » ('j') | net/http/http_chunked_decoder_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698