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

Side by Side Diff: chrome/utility/safe_browsing/mac/udif.h

Issue 2141963002: Validate safe_browsing::dmg::UDIFBlock data before attempting to read at its offsets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 5 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
« no previous file with comments | « chrome/utility/safe_browsing/mac/hfs.cc ('k') | chrome/utility/safe_browsing/mac/udif.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ 5 #ifndef CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_
6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ 6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_
7 7
8 #include <CoreFoundation/CoreFoundation.h> 8 #include <CoreFoundation/CoreFoundation.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 size_t GetPartitionSize(size_t part_number); 69 size_t GetPartitionSize(size_t part_number);
70 70
71 // Returns a stream of the raw partition data for the given partition 71 // Returns a stream of the raw partition data for the given partition
72 // number. 72 // number.
73 std::unique_ptr<ReadStream> GetPartitionReadStream(size_t part_number); 73 std::unique_ptr<ReadStream> GetPartitionReadStream(size_t part_number);
74 74
75 private: 75 private:
76 // Parses the blkx plist trailer structure. 76 // Parses the blkx plist trailer structure.
77 bool ParseBlkx(); 77 bool ParseBlkx();
78 78
79 // Reads the data pointed to by the block |chunk|, decompressing it as
80 // necessary, into the out-buffer |decompressed_data|.
81 bool ReadBlockChunk(const UDIFBlockChunk* chunk,
82 std::vector<uint8_t>* decompressed_data);
83
84 ReadStream* const stream_; // The stream backing the UDIF image. Weak. 79 ReadStream* const stream_; // The stream backing the UDIF image. Weak.
85 std::vector<std::string> partition_names_; // The names of all partitions. 80 std::vector<std::string> partition_names_; // The names of all partitions.
86 ScopedVector<const UDIFBlock> blocks_; // All blocks in the UDIF image. 81 ScopedVector<const UDIFBlock> blocks_; // All blocks in the UDIF image.
87 uint16_t block_size_; // The image's block size, in bytes. 82 uint16_t block_size_; // The image's block size, in bytes.
88 83
89 DISALLOW_COPY_AND_ASSIGN(UDIFParser); 84 DISALLOW_COPY_AND_ASSIGN(UDIFParser);
90 }; 85 };
91 86
92 } // namespace dmg 87 } // namespace dmg
93 } // namespace safe_browsing 88 } // namespace safe_browsing
94 89
95 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_ 90 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_UDIF_H_
OLDNEW
« no previous file with comments | « chrome/utility/safe_browsing/mac/hfs.cc ('k') | chrome/utility/safe_browsing/mac/udif.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698