aboutsummaryrefslogtreecommitdiff
path: root/lib/UnrarXLib
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@xbmc.org>2012-05-16 00:14:49 +0300
committerAnssi Hannula <anssi@xbmc.org>2012-05-16 19:30:21 +0300
commit840cd4ce4ac8c781e7d35db2ed86d575a42c37e7 (patch)
tree6c54e430db79b5e4091806551030daee308a321e /lib/UnrarXLib
parent617a0ff041fd18f587f2cf2fd5249de0988a764c (diff)
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().
Diffstat (limited to 'lib/UnrarXLib')
-rw-r--r--lib/UnrarXLib/extract.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/lib/UnrarXLib/extract.cpp b/lib/UnrarXLib/extract.cpp
index da608572de..ea9b8f9257 100644
--- a/lib/UnrarXLib/extract.cpp
+++ b/lib/UnrarXLib/extract.cpp
@@ -859,10 +859,7 @@ void CmdExtract::UnstoreFile(ComprDataIO &DataIO,Int64 DestUnpSize)
}
if (Code > 0)
{
- Code=Code<DestUnpSize ? Code:int64to32(DestUnpSize);
DataIO.UnpWrite(&Buffer[0],Code);
- if (DestUnpSize>=0)
- DestUnpSize-=Code;
}
else
{