| Index: webkit/fileapi/media/picasa/pmp_column_reader.cc
|
| diff --git a/webkit/fileapi/media/picasa/pmp_column_reader.cc b/webkit/fileapi/media/picasa/pmp_column_reader.cc
|
| index 3f6bcc480f7a361928fdddbd1cd8d7b2d2c18c42..07066b86fe7b7c15ad53ebd034b53a45da640520 100644
|
| --- a/webkit/fileapi/media/picasa/pmp_column_reader.cc
|
| +++ b/webkit/fileapi/media/picasa/pmp_column_reader.cc
|
| @@ -22,11 +22,13 @@ const size_t kPmpMaxFilesize = 50*1024*1024; // Maximum of 50 MB.
|
| PmpColumnReader::PmpColumnReader()
|
| : length_(0),
|
| field_type_(PMP_TYPE_INVALID),
|
| - rows_(0) { }
|
| + rows_(0) {}
|
|
|
| -PmpColumnReader::~PmpColumnReader() { }
|
| +PmpColumnReader::~PmpColumnReader() {}
|
|
|
| -bool PmpColumnReader::Init(const base::FilePath& filepath, uint32* rows_read) {
|
| +bool PmpColumnReader::Init(const base::FilePath& filepath,
|
| + const PmpFieldType expected_type,
|
| + uint32* rows_read) {
|
| DCHECK(!data_.get());
|
| base::ThreadRestrictions::AssertIOAllowed();
|
|
|
| @@ -44,7 +46,7 @@ bool PmpColumnReader::Init(const base::FilePath& filepath, uint32* rows_read) {
|
| char* data_begin = reinterpret_cast<char*>(data_.get());
|
|
|
| return file_util::ReadFile(filepath, data_begin, length_) &&
|
| - ParseData(rows_read);
|
| + ParseData(expected_type, rows_read);
|
| }
|
|
|
| bool PmpColumnReader::ReadString(const uint32 row, std::string* result) const {
|
| @@ -102,7 +104,8 @@ bool PmpColumnReader::ReadUInt64(const uint32 row, uint64* result) const {
|
| return true;
|
| }
|
|
|
| -bool PmpColumnReader::ParseData(uint32* rows_read) {
|
| +bool PmpColumnReader::ParseData(const PmpFieldType expected_type,
|
| + uint32* rows_read) {
|
| DCHECK(data_.get() != NULL);
|
| DCHECK_GE(length_, kPmpHeaderSize);
|
|
|
| @@ -125,6 +128,9 @@ bool PmpColumnReader::ParseData(uint32* rows_read) {
|
|
|
| field_type_ = static_cast<PmpFieldType>(field_type_data);
|
|
|
| + if (field_type_ != expected_type)
|
| + return false;
|
| +
|
| rows_ = *(reinterpret_cast<uint32*>(&data_[kPmpRowCountOffset]));
|
|
|
| size_t body_length = length_ - kPmpHeaderSize;
|
|
|