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

Side by Side Diff: ppapi/c/ppb_file_io.h

Issue 7651002: Adding checks to guard against buffer overruns in QuotaFileIO::Write and base::FileUtilProxy::Write (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | « base/file_util_proxy.cc ('k') | webkit/plugins/ppapi/quota_file_io.h » ('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) 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 5
6 /* From ppb_file_io.idl modified Wed Jul 13 16:41:25 2011. */ 6 /* From ppb_file_io.idl modified Wed Jul 13 16:41:25 2011. */
7 7
8 #ifndef PPAPI_C_PPB_FILE_IO_H_ 8 #ifndef PPAPI_C_PPB_FILE_IO_H_
9 #define PPAPI_C_PPB_FILE_IO_H_ 9 #define PPAPI_C_PPB_FILE_IO_H_
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 * 157 *
158 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 158 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
159 * FileIO. 159 * FileIO.
160 * @param[in] offset The offset into the file. 160 * @param[in] offset The offset into the file.
161 * @param[in] buffer The buffer to hold the specified number of bytes read. 161 * @param[in] buffer The buffer to hold the specified number of bytes read.
162 * @param[in] bytes_to_read The number of bytes to read from 162 * @param[in] bytes_to_read The number of bytes to read from
163 * <code>offset</code>. 163 * <code>offset</code>.
164 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 164 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
165 * completion of Read(). 165 * completion of Read().
166 * 166 *
167 * @return An The number of bytes read an error code from 167 * @return An The number of bytes read or an error code from
168 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was 168 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was
169 * reached. It is valid to call Read() multiple times with a completion 169 * reached. It is valid to call Read() multiple times with a completion
170 * callback to queue up parallel reads from the file at different offsets. 170 * callback to queue up parallel reads from the file at different offsets.
171 */ 171 */
172 int32_t (*Read)(PP_Resource file_io, 172 int32_t (*Read)(PP_Resource file_io,
173 int64_t offset, 173 int64_t offset,
174 char* buffer, 174 char* buffer,
175 int32_t bytes_to_read, 175 int32_t bytes_to_read,
176 struct PP_CompletionCallback callback); 176 struct PP_CompletionCallback callback);
177 /** 177 /**
178 * Write() writes to an offset in the file. This function might perform a 178 * Write() writes to an offset in the file. This function might perform a
179 * partial write. The FileIO object must have been opened with write access. 179 * partial write. The FileIO object must have been opened with write access.
180 * 180 *
181 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 181 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
182 * FileIO. 182 * FileIO.
183 * @param[in] offset The offset into the file. 183 * @param[in] offset The offset into the file.
184 * @param[in] buffer The buffer to hold the specified number of bytes read. 184 * @param[in] buffer The buffer to hold the specified number of bytes read.
185 * @param[in] bytes_to_write The number of bytes to write to 185 * @param[in] bytes_to_write The number of bytes to write to
186 * <code>offset</code>. 186 * <code>offset</code>.
187 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 187 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
188 * completion of Write(). 188 * completion of Write().
189 * 189 *
190 * @return An The number of bytes written or an error code from 190 * @return An The number of bytes written or an error code from
191 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was 191 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was
192 * reached. It is valid to call Write() multiple times with a completion 192 * reached. It is valid to call Write() multiple times with a completion
193 * callback to queue up parallel writes to the file at different offsets. 193 * callback to queue up parallel writes to the file at different offsets. If
194 * bytes_to_write is less than or equal to zero, return value is
195 * PP_ERROR_FAILED.
noelallen_use_chromium 2011/08/17 18:56:10 These changes will be lost on the next generation.
194 */ 196 */
195 int32_t (*Write)(PP_Resource file_io, 197 int32_t (*Write)(PP_Resource file_io,
196 int64_t offset, 198 int64_t offset,
197 const char* buffer, 199 const char* buffer,
198 int32_t bytes_to_write, 200 int32_t bytes_to_write,
199 struct PP_CompletionCallback callback); 201 struct PP_CompletionCallback callback);
200 /** 202 /**
201 * SetLength() sets the length of the file. If the file size is extended, 203 * SetLength() sets the length of the file. If the file size is extended,
202 * then the extended area of the file is zero-filled. The FileIO object must 204 * then the extended area of the file is zero-filled. The FileIO object must
203 * have been opened with write access. 205 * have been opened with write access.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 238 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
237 * FileIO. 239 * FileIO.
238 */ 240 */
239 void (*Close)(PP_Resource file_io); 241 void (*Close)(PP_Resource file_io);
240 }; 242 };
241 /** 243 /**
242 * @} 244 * @}
243 */ 245 */
244 246
245 #endif /* PPAPI_C_PPB_FILE_IO_H_ */ 247 #endif /* PPAPI_C_PPB_FILE_IO_H_ */
246
OLDNEW
« no previous file with comments | « base/file_util_proxy.cc ('k') | webkit/plugins/ppapi/quota_file_io.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698