Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed: CRarFile::Read() returning wrong data after some seek patterns
Certain seek patterns on a file inside a non-compressed rar file can cause CmdExtract::UnstoreFile() to think that the destination buffer has been filled (as DestUnpSize counter, originally set to the file size, reaches zero). However, counting written bytes using DestUnpSize doesn't make sense for the UnpackToMemory codepath used for non-compressed rar files, as there can be seeks which can eventually cause more data to be read than what the actual file size was. The actual output buffer is internally handled by ComprDataIO. The check in UnstoreFile() will result in not all data being written to the destination buffer, causing CRarFile::Read() to return old stale data. Fix that by dropping the unnecessary DestUnpSize handling in UnpackToMemory codepath of CmdExtract::UnstoreFile().
- Loading branch information