diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-12-03 13:40:17 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-12-04 10:31:40 +0400 |
commit | 02ef6c525980eb6d976f350cb49526eba36b65c5 (patch) | |
tree | 5c452a8c4f003465be6b45e469dc108623fc616a /src/thirdparty/unrar | |
parent | beffb9ae57d78e6edb87ca89cfe29778b98529fb (diff) |
Update Unrar to 5.0.0.14.
Diffstat (limited to 'src/thirdparty/unrar')
-rw-r--r-- | src/thirdparty/unrar/arcread.cpp | 11 | ||||
-rw-r--r-- | src/thirdparty/unrar/dll.cpp | 11 | ||||
-rw-r--r-- | src/thirdparty/unrar/dll.rc | 8 | ||||
-rw-r--r-- | src/thirdparty/unrar/extract.cpp | 2 | ||||
-rw-r--r-- | src/thirdparty/unrar/file.cpp | 20 | ||||
-rw-r--r-- | src/thirdparty/unrar/version.hpp | 6 |
6 files changed, 41 insertions, 17 deletions
diff --git a/src/thirdparty/unrar/arcread.cpp b/src/thirdparty/unrar/arcread.cpp index 69a371e8e..f9661968e 100644 --- a/src/thirdparty/unrar/arcread.cpp +++ b/src/thirdparty/unrar/arcread.cpp @@ -88,7 +88,8 @@ void Archive::UnexpEndArcMsg() // If block positions are equal to file size, this is not an error. // It can happen when we reached the end of older RAR 1.5 archive, // which did not have the end of archive block. - if (CurBlockPos>ArcSize || NextBlockPos>ArcSize) + if (CurBlockPos>ArcSize || NextBlockPos>ArcSize || + CurBlockPos!=ArcSize && NextBlockPos!=ArcSize && Format==RARFMT50) { #ifndef SHELL_EXT Log(FileName,St(MLogUnexpEOF)); @@ -609,7 +610,11 @@ size_t Archive::ReadHeader50() // resulting in 2 MB maximum header size, so here we read 4 byte CRC32 // followed by 3 bytes or less of header size. const size_t FirstReadSize=7; - Raw.Read(FirstReadSize); + if (Raw.Read(FirstReadSize)<FirstReadSize) + { + UnexpEndArcMsg(); + return 0; + } ShortBlock.Reset(); ShortBlock.HeadCRC=Raw.Get4(); @@ -618,7 +623,7 @@ size_t Archive::ReadHeader50() if (BlockSize==0 || SizeBytes==0) { - UnexpEndArcMsg(); // Incomplete or broken block size field. + BrokenHeaderMsg(); return 0; } diff --git a/src/thirdparty/unrar/dll.cpp b/src/thirdparty/unrar/dll.cpp index 20e5437e8..f60928ee8 100644 --- a/src/thirdparty/unrar/dll.cpp +++ b/src/thirdparty/unrar/dll.cpp @@ -195,7 +195,16 @@ int PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *D) } else return ERAR_EOPEN; - return(Data->Arc.BrokenHeader ? ERAR_BAD_DATA:ERAR_END_ARCHIVE); + + if (Data->Arc.BrokenHeader) + return ERAR_BAD_DATA; + + // Might be necessary if RARSetPassword is still called instead of + // open callback for RAR5 archives and if password is invalid. + if (Data->Arc.FailedHeaderDecryption) + return ERAR_BAD_PASSWORD; + + return ERAR_END_ARCHIVE; } FileHeader *hd=&Data->Arc.FileHead; if (Data->OpenMode==RAR_OM_LIST && hd->SplitBefore) diff --git a/src/thirdparty/unrar/dll.rc b/src/thirdparty/unrar/dll.rc index dbe1603f4..df361fdd0 100644 --- a/src/thirdparty/unrar/dll.rc +++ b/src/thirdparty/unrar/dll.rc @@ -2,8 +2,8 @@ #include <commctrl.h>
VS_VERSION_INFO VERSIONINFO
-FILEVERSION 5, 1, 1, 1047
-PRODUCTVERSION 5, 1, 1, 1047
+FILEVERSION 5, 1, 100, 1066
+PRODUCTVERSION 5, 1, 100, 1066
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
{
@@ -14,8 +14,8 @@ FILETYPE VFT_APP VALUE "CompanyName", "Alexander Roshal\0"
VALUE "ProductName", "RAR decompression library\0"
VALUE "FileDescription", "RAR decompression library\0"
- VALUE "FileVersion", "5.1.1\0"
- VALUE "ProductVersion", "5.1.1\0"
+ VALUE "FileVersion", "5.1.0\0"
+ VALUE "ProductVersion", "5.1.0\0"
VALUE "LegalCopyright", "Copyright © Alexander Roshal 1993-2013\0"
VALUE "OriginalFilename", "Unrar.dll\0"
}
diff --git a/src/thirdparty/unrar/extract.cpp b/src/thirdparty/unrar/extract.cpp index 6d36112b6..746904001 100644 --- a/src/thirdparty/unrar/extract.cpp +++ b/src/thirdparty/unrar/extract.cpp @@ -643,7 +643,7 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderS // If we already have ERAR_EOPEN as result of missing volume,
// we should not replace it with less precise ERAR_BAD_DATA.
if (Cmd->DllError!=ERAR_EOPEN)
- Cmd->DllError=ERAR_BAD_DATA;
+ Cmd->DllError=WrongPassword ? ERAR_BAD_PASSWORD : ERAR_BAD_DATA;
#endif
}
}
diff --git a/src/thirdparty/unrar/file.cpp b/src/thirdparty/unrar/file.cpp index 7b8c2cfc8..0da3f3d4a 100644 --- a/src/thirdparty/unrar/file.cpp +++ b/src/thirdparty/unrar/file.cpp @@ -60,17 +60,27 @@ bool File::Open(const wchar *Name,uint Mode) DWORD LastError; if (hNewFile==BAD_HANDLE) { - // Following CreateFile("\\?\path") call can change the last error code - // from "not found" to "access denied" for relative paths like "..\path". - // But we need the correct "not found" code to create a new archive - // if existing one is not found. So we preserve the code here. LastError=GetLastError(); wchar LongName[NM]; if (GetWinLongPath(Name,LongName,ASIZE(LongName))) { hNewFile=CreateFile(LongName,Access,ShareMode,NULL,OPEN_EXISTING,Flags,NULL); - LastError=GetLastError(); + + // For archive names longer than 260 characters first CreateFile + // (without \\?\) fails and sets LastError to 3 (access denied). + // We need the correct "file not found" error code to decide + // if we create a new archive or quit with "cannot create" error. + // So we need to check the error code after \\?\ CreateFile again, + // otherwise we'll fail to create new archives with long names. + // But we cannot simply assign the new code to LastError, + // because it would break "..\arcname.rar" relative names processing. + // First CreateFile returns the correct "file not found" code for such + // names, but "\\?\" CreateFile returns ERROR_INVALID_NAME treating + // dots as a directory name. So we check only for "file not found" + // error here and for other errors use the first CreateFile result. + if (GetLastError()==ERROR_FILE_NOT_FOUND) + LastError=ERROR_FILE_NOT_FOUND; } } diff --git a/src/thirdparty/unrar/version.hpp b/src/thirdparty/unrar/version.hpp index ce7a3a6f0..e28ea9827 100644 --- a/src/thirdparty/unrar/version.hpp +++ b/src/thirdparty/unrar/version.hpp @@ -1,6 +1,6 @@ #define RARVER_MAJOR 5 #define RARVER_MINOR 1 -#define RARVER_BETA 1 -#define RARVER_DAY 12 -#define RARVER_MONTH 11 +#define RARVER_BETA 0 +#define RARVER_DAY 1 +#define RARVER_MONTH 12 #define RARVER_YEAR 2013 |