From c6f8765250df8f5996950805afb94ec2c80c6723 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Mon, 17 Jul 2017 15:49:08 +0100 Subject: [PATCH] Added unrar 5.5.2 --- unrar/dll.rc | 4 ++-- unrar/extract.cpp | 24 ++++++++++++++++++------ unrar/match.cpp | 10 +++++----- unrar/rarvm.cpp | 2 +- unrar/strfn.cpp | 16 +++++++++++++--- unrar/strfn.hpp | 3 ++- unrar/version.hpp | 2 +- 7 files changed, 42 insertions(+), 19 deletions(-) diff --git a/unrar/dll.rc b/unrar/dll.rc index 5b2fda8..07fedf9 100644 --- a/unrar/dll.rc +++ b/unrar/dll.rc @@ -2,8 +2,8 @@ #include VS_VERSION_INFO VERSIONINFO -FILEVERSION 5, 50, 1, 2297 -PRODUCTVERSION 5, 50, 1, 2297 +FILEVERSION 5, 50, 1, 2303 +PRODUCTVERSION 5, 50, 1, 2303 FILEOS VOS__WINDOWS32 FILETYPE VFT_APP { diff --git a/unrar/extract.cpp b/unrar/extract.cpp index af3474a..c980c9a 100644 --- a/unrar/extract.cpp +++ b/unrar/extract.cpp @@ -853,13 +853,25 @@ void CmdExtract::ExtrPrepareName(Archive &Arc,const wchar *ArcFileName,wchar *De if (ArcPathLength>0) { size_t NameLength=wcslen(ArcFileName); - ArcFileName+=Min(ArcPathLength,NameLength); - while (*ArcFileName==CPATHDIVIDER) - ArcFileName++; - if (*ArcFileName==0) // Excessive -ap switch. + + // Earlier we compared lengths only here, but then noticed a cosmetic bug + // in WinRAR. When extracting a file reference from subfolder with + // "Extract relative paths", so WinRAR sets ArcPath, if reference target + // is missing, error message removed ArcPath both from reference and target + // names. If target was stored in another folder, its name looked wrong. + if (NameLength>=ArcPathLength && + wcsnicompc(Cmd->ArcPath,ArcFileName,ArcPathLength)==0 && + (IsPathDiv(Cmd->ArcPath[ArcPathLength-1]) || + IsPathDiv(ArcFileName[ArcPathLength]) || ArcFileName[ArcPathLength]==0)) { - *DestName=0; - return; + ArcFileName+=Min(ArcPathLength,NameLength); + while (IsPathDiv(*ArcFileName)) + ArcFileName++; + if (*ArcFileName==0) // Excessive -ap switch. + { + *DestName=0; + return; + } } } #endif diff --git a/unrar/match.cpp b/unrar/match.cpp index 3486b0e..4369a57 100644 --- a/unrar/match.cpp +++ b/unrar/match.cpp @@ -128,18 +128,18 @@ bool match(const wchar *pattern,const wchar *string,bool ForceCase) int mwcsicompc(const wchar *Str1,const wchar *Str2,bool ForceCase) { if (ForceCase) - return(wcscmp(Str1,Str2)); - return(wcsicompc(Str1,Str2)); + return wcscmp(Str1,Str2); + return wcsicompc(Str1,Str2); } int mwcsnicompc(const wchar *Str1,const wchar *Str2,size_t N,bool ForceCase) { if (ForceCase) - return(wcsncmp(Str1,Str2,N)); + return wcsncmp(Str1,Str2,N); #if defined(_UNIX) - return(wcsncmp(Str1,Str2,N)); + return wcsncmp(Str1,Str2,N); #else - return(wcsnicomp(Str1,Str2,N)); + return wcsnicomp(Str1,Str2,N); #endif } diff --git a/unrar/rarvm.cpp b/unrar/rarvm.cpp index 0e98e04..3d4d0b5 100644 --- a/unrar/rarvm.cpp +++ b/unrar/rarvm.cpp @@ -25,7 +25,7 @@ void RarVM::Execute(VM_PreparedProgram *Prg) if (Prg->Type!=VMSF_NONE) { ExecuteStandardFilter(Prg->Type); - uint BlockSize=Prg->InitR[4]; + uint BlockSize=Prg->InitR[4] & VM_MEMMASK; Prg->FilteredDataSize=BlockSize; if (Prg->Type==VMSF_DELTA || Prg->Type==VMSF_RGB || Prg->Type==VMSF_AUDIO) Prg->FilteredData=2*BlockSize>=VM_MEMSIZE ? Mem:Mem+BlockSize; diff --git a/unrar/strfn.cpp b/unrar/strfn.cpp index a959b08..283c67b 100644 --- a/unrar/strfn.cpp +++ b/unrar/strfn.cpp @@ -255,12 +255,22 @@ bool LowAscii(const wchar *Str) } -int wcsicompc(const wchar *Str1,const wchar *Str2) // For path comparison. +int wcsicompc(const wchar *s1,const wchar *s2) // For path comparison. { #if defined(_UNIX) - return wcscmp(Str1,Str2); + return wcscmp(s1,s2); #else - return wcsicomp(Str1,Str2); + return wcsicomp(s1,s2); +#endif +} + + +int wcsnicompc(const wchar *s1,const wchar *s2,size_t n) +{ +#if defined(_UNIX) + return wcsncmp(s1,s2,n); +#else + return wcsnicomp(s1,s2,n); #endif } diff --git a/unrar/strfn.hpp b/unrar/strfn.hpp index d6d8d12..7faac42 100644 --- a/unrar/strfn.hpp +++ b/unrar/strfn.hpp @@ -36,7 +36,8 @@ uint GetDigits(uint Number); bool LowAscii(const char *Str); bool LowAscii(const wchar *Str); -int wcsicompc(const wchar *Str1,const wchar *Str2); +int wcsicompc(const wchar *s1,const wchar *s2); +int wcsnicompc(const wchar *s1,const wchar *s2,size_t n); void itoa(int64 n,char *Str,size_t MaxSize); void itoa(int64 n,wchar *Str,size_t MaxSize); diff --git a/unrar/version.hpp b/unrar/version.hpp index 0b4eefd..9354977 100644 --- a/unrar/version.hpp +++ b/unrar/version.hpp @@ -1,6 +1,6 @@ #define RARVER_MAJOR 5 #define RARVER_MINOR 50 #define RARVER_BETA 1 -#define RARVER_DAY 12 +#define RARVER_DAY 18 #define RARVER_MONTH 4 #define RARVER_YEAR 2017