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

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

Issue 2926473002: Mac Archive Type Sniffing (Closed)
Patch Set: minor edit to comment 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..6b9d46d26176864e68c33d1e54c68cad71e93af4 100644
--- a/chrome/utility/safe_browsing/mac/udif.h
+++ b/chrome/utility/safe_browsing/mac/udif.h
@@ -23,6 +23,8 @@ namespace dmg {
class ReadStream;
class UDIFBlock;
Robert Sesek 2017/06/12 20:52:34 nit: no blank line (and sort by type name between
mortonm 2017/06/12 21:39:49 Done.
+struct UDIFResourceFile;
+
// UDIFParser parses a Universal Disk Image Format file, allowing access to the
// name, types, and data of the partitions held within the file. There is no
// canonical documentation for UDIF, and not all disk images use UDIF (though
@@ -71,7 +73,12 @@ class UDIFParser {
std::unique_ptr<ReadStream> GetPartitionReadStream(size_t part_number);
private:
- // Parses the blkx plist trailer structure.
+ // 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();
+
+ // Parses the blkx plist structure.
bool ParseBlkx();
ReadStream* const stream_; // The stream backing the UDIF image. Weak.
@@ -79,6 +86,8 @@ 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.
+ std::unique_ptr<UDIFResourceFile> trailer_;
Robert Sesek 2017/06/12 20:52:34 These two members need comments.
mortonm 2017/06/12 21:39:49 Done.
+ bool trailer_successfully_parsed_;
DISALLOW_COPY_AND_ASSIGN(UDIFParser);
};

Powered by Google App Engine
This is Rietveld 408576698