Index: third_party/zlib/google/zip.cc |
diff --git a/third_party/zlib/google/zip.cc b/third_party/zlib/google/zip.cc |
index 64aead1d64a1edfae35e9d21acb8025c97b151e4..ae33c151fccd5dbf0976e0d63c5d2507a9802d9f 100644 |
--- a/third_party/zlib/google/zip.cc |
+++ b/third_party/zlib/google/zip.cc |
@@ -51,8 +51,10 @@ bool AddFileToZip(zipFile zip_file, const base::FilePath& src_dir) { |
bool AddEntryToZip(zipFile zip_file, const base::FilePath& path, |
const base::FilePath& root_path) { |
- std::string str_path = |
- path.AsUTF8Unsafe().substr(root_path.AsUTF8Unsafe().length() + 1); |
+ base::FilePath relative_path; |
+ bool result = root_path.AppendRelativePath(path, &relative_path); |
+ DCHECK(result); |
+ std::string str_path = relative_path.AsUTF8Unsafe(); |
#if defined(OS_WIN) |
ReplaceSubstringsAfterOffset(&str_path, 0u, "\\", "/"); |
#endif |