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

Side by Side Diff: webkit/blob/blob_url_request_job.h

Issue 12047012: Avoid integer overflows in BlobURLRequestJob. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use kint64max Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/blob/blob_url_request_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ 5 #ifndef WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_
6 #define WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ 6 #define WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 const net::HttpRequestHeaders& headers) OVERRIDE; 53 const net::HttpRequestHeaders& headers) OVERRIDE;
54 54
55 protected: 55 protected:
56 virtual ~BlobURLRequestJob(); 56 virtual ~BlobURLRequestJob();
57 57
58 private: 58 private:
59 typedef std::map<size_t, FileStreamReader*> IndexToReaderMap; 59 typedef std::map<size_t, FileStreamReader*> IndexToReaderMap;
60 60
61 // For preparing for read: get the size, apply the range and perform seek. 61 // For preparing for read: get the size, apply the range and perform seek.
62 void DidStart(); 62 void DidStart();
63 bool AddItemLength(size_t index, int64 item_length);
63 void CountSize(); 64 void CountSize();
64 void DidCountSize(int error); 65 void DidCountSize(int error);
65 void DidGetFileItemLength(size_t index, int64 result); 66 void DidGetFileItemLength(size_t index, int64 result);
66 void Seek(int64 offset); 67 void Seek(int64 offset);
67 68
68 // For reading the blob. 69 // For reading the blob.
69 bool ReadLoop(int* bytes_read); 70 bool ReadLoop(int* bytes_read);
70 bool ReadItem(); 71 bool ReadItem();
71 void AdvanceItem(); 72 void AdvanceItem();
72 void AdvanceBytesRead(int result); 73 void AdvanceBytesRead(int result);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 bool byte_range_set_; 108 bool byte_range_set_;
108 net::HttpByteRange byte_range_; 109 net::HttpByteRange byte_range_;
109 scoped_ptr<net::HttpResponseInfo> response_info_; 110 scoped_ptr<net::HttpResponseInfo> response_info_;
110 111
111 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); 112 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob);
112 }; 113 };
113 114
114 } // namespace webkit_blob 115 } // namespace webkit_blob
115 116
116 #endif // WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ 117 #endif // WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/blob/blob_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698