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

Unified Diff: third_party/zlib/google/zip_reader.h

Issue 2961373002: Improve Zip File Scanning on Mac (Closed)
Patch Set: removing check for .app on windows Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/zlib/google/zip_reader.h
diff --git a/third_party/zlib/google/zip_reader.h b/third_party/zlib/google/zip_reader.h
index c1b6fb3364abeba3c34231e9dd1fea500540029e..1ba76a7fcfc37e910ef03332f28664a43fa93817 100644
--- a/third_party/zlib/google/zip_reader.h
+++ b/third_party/zlib/google/zip_reader.h
@@ -162,6 +162,11 @@ class ZipReader {
// Extracts the current entry in chunks to |delegate|.
bool ExtractCurrentEntry(WriterDelegate* delegate) const;
+ // Extracts part of the current entry to |delegate|, starting from the
+ // beginning of the entry.
+ bool ExtractPartOfCurrentEntry(WriterDelegate* delegate,
+ size_t num_bytes) const;
satorux1 2017/07/14 01:00:53 Could you add a unit test for this function to zip
mortonm 2017/07/14 17:08:45 Done.
+
// Extracts the current entry to the given output file path. If the
// current file is a directory, just creates a directory
// instead. Returns true on success. OpenCurrentEntryInZip() must be
@@ -217,6 +222,13 @@ class ZipReader {
size_t max_read_bytes,
std::string* output) const;
+ // Same as ExtractCurrentEntryToString(), except specifies the number of bytes
+ // to read into the string so that it is possible to only read a partial
+ // amount of the entry into a string. This is used to infer the type of
+ // MachO files on Mac by sniffing their magic number in the header.
+ bool ExtractPartOfCurrentEntryToString(size_t max_read_bytes,
satorux1 2017/07/14 01:00:53 Ditto.
mortonm 2017/07/14 17:08:45 Done.
+ std::string* output) const;
+
// Returns the current entry info. Returns NULL if the current entry is
// not yet opened. OpenCurrentEntryInZip() must be called beforehand.
EntryInfo* current_entry_info() const {
« no previous file with comments | « chrome/test/data/safe_browsing/mach_o/zipped-app-with-executable.zip ('k') | third_party/zlib/google/zip_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698