| Index: media/cdm/ppapi/cdm_file_io_impl.cc
|
| diff --git a/media/cdm/ppapi/cdm_file_io_impl.cc b/media/cdm/ppapi/cdm_file_io_impl.cc
|
| index 726388949ec483ef1ad05191e95a212b0677d29f..4dd13bfaa5e3d7e54b631ab1317f35cc9bde8e27 100644
|
| --- a/media/cdm/ppapi/cdm_file_io_impl.cc
|
| +++ b/media/cdm/ppapi/cdm_file_io_impl.cc
|
| @@ -166,7 +166,12 @@ void CdmFileIOImpl::Write(const uint8_t* data, uint32_t data_size) {
|
| state_ = WRITING_FILE;
|
|
|
| // Always SetLength() in case |data_size| is less than the file size.
|
| - SetLength(data_size);
|
| + // Otherwise only part of the file is overwritten and the file length will
|
| + // remain the old length.
|
| + // Set length to 0 instead of |data_size| to avoid a corrupted file if
|
| + // |this| is destructed after SetLength() is called but before WriteFile()
|
| + // is called.
|
| + SetLength(0);
|
| }
|
|
|
| void CdmFileIOImpl::Close() {
|
|
|