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

Unified Diff: chrome/utility/safe_browsing/mac/udif.h

Issue 2926473002: Mac Archive Type Sniffing (Closed)
Patch Set: matching style Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/utility/safe_browsing/mac/udif.h
diff --git a/chrome/utility/safe_browsing/mac/udif.h b/chrome/utility/safe_browsing/mac/udif.h
index fbb17c9280743e2611deba7d9955657f8e175413..1bdef19188295aa52888a45cdd25ae92bef884bf 100644
--- a/chrome/utility/safe_browsing/mac/udif.h
+++ b/chrome/utility/safe_browsing/mac/udif.h
@@ -47,6 +47,11 @@ class UDIFParser {
explicit UDIFParser(ReadStream* stream);
~UDIFParser();
+ // Parses the trailer structure. Only actually parses data from the file the
+ // first time it is called -- after that just returns the previous result when
+ // parsing was attempted.
+ bool ParseTrailer();
Robert Sesek 2017/06/12 16:38:39 This should be private, callers should only call P
mortonm 2017/06/12 18:31:16 Yeah, that does seem like a better interface. One
mortonm 2017/06/12 20:04:01 Actually, there is another issue to consider here.
Robert Sesek 2017/06/12 20:52:34 Yes, that's definitely a security issue. We should
mortonm 2017/06/12 21:39:49 As addressed in the later comment, we think we nee
+
// Parses the UDIF file. This method must be called before any other method.
// If this returns false, it is not legal to call any other methods.
bool Parse();
@@ -71,7 +76,7 @@ class UDIFParser {
std::unique_ptr<ReadStream> GetPartitionReadStream(size_t part_number);
private:
- // Parses the blkx plist trailer structure.
+ // Parses the blkx plist structure.
bool ParseBlkx();
ReadStream* const stream_; // The stream backing the UDIF image. Weak.
@@ -79,6 +84,10 @@ class UDIFParser {
// All blocks in the UDIF image.
std::vector<std::unique_ptr<const UDIFBlock>> blocks_;
uint16_t block_size_; // The image's block size, in bytes.
+ uint32_t trailer_signature_;
+ uint64_t plist_length_;
+ uint64_t plist_offset_;
+ bool trailer_successfully_parsed_;
DISALLOW_COPY_AND_ASSIGN(UDIFParser);
};

Powered by Google App Engine
This is Rietveld 408576698