From 24be8c0814943b845ab3037d552d28f77ef8bbc9 Mon Sep 17 00:00:00 2001 From: BhaaL Date: Sat, 21 Jan 2017 21:26:19 +0100 Subject: [PATCH] IsGCZBlob: try to leave the file position where it was before callers that don't seek afterwards might be missing a few bytes that way. --- Source/Core/DiscIO/CompressedBlob.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index 0cf8dbc5b3..447088de61 100644 --- a/Source/Core/DiscIO/CompressedBlob.cpp +++ b/Source/Core/DiscIO/CompressedBlob.cpp @@ -410,8 +410,13 @@ bool DecompressBlobToFile(const std::string& infile_path, const std::string& out bool IsGCZBlob(File::IOFile& file) { + const u64 position = file.Tell(); + if (!file.Seek(0, SEEK_SET)) + return false; CompressedBlobHeader header; - return file.Seek(0, SEEK_SET) && file.ReadArray(&header, 1) && header.magic_cookie == GCZ_MAGIC; + bool is_gcz = file.ReadArray(&header, 1) && header.magic_cookie == GCZ_MAGIC; + file.Seek(position, SEEK_SET); + return is_gcz; } } // namespace