@@ -684,6 +684,7 @@ void FPakVFS::DecryptDataBlock(byte* Data, int DataSize)
684
684
guard (FPakVFS::DecryptDataBlock);
685
685
686
686
const FString& Key = GetPakEncryptionKey ();
687
+ if (Key.Len () == 0 ) appError (" Empty AES key" );
687
688
appDecryptAES (Data, DataSize, &Key[0 ], Key.Len ());
688
689
689
690
unguard;
@@ -967,19 +968,25 @@ bool FPakVFS::LoadPakIndex(FArchive* reader, const FPakInfo& info, FString& erro
967
968
FolderIndex = RegisterGameFolder (*DirectoryPath);
968
969
}
969
970
970
- for (int DirectoryFileIndex = 0 ; DirectoryFileIndex < NumFilesInDirectory; DirectoryFileIndex++)
971
+ for (int DirectoryFileIndex = 0 ; DirectoryFileIndex < NumFilesInDirectory; DirectoryFileIndex++, FileIndex++ )
971
972
{
972
973
guard (File);
973
974
// Read FPakDirectory entry Key
974
975
FStaticString<MAX_PACKAGE_PATH> DirectoryFileName;
975
976
InfoReader << DirectoryFileName;
977
+
976
978
// Read FPakDirectory entry Value
979
+ // PakEntryLocation is positive (offset in 'EncodedPakEntries') or negative (index in 'Files').
977
980
int32 PakEntryLocation;
978
981
InfoReader << PakEntryLocation;
982
+ if (PakEntryLocation == 0x7fffffff || PakEntryLocation == 0x80000000 )
983
+ {
984
+ // 0x7fffffff and 0x80000000 are special values, "Invalid" or "Unused"
985
+ continue ;
986
+ }
979
987
980
988
FPakEntry& E = FileInfos[FileIndex];
981
989
982
- // PakEntryLocation is positive (offset in 'EncodedPakEntries') or negative (index in 'Files')
983
990
// References in UE4:
984
991
// FPakFile::DecodePakEntry <- FPakFile::GetPakEntry (decode or pick from 'Files') <- FPakFile::Find (name to index/location)
985
992
if (PakEntryLocation < 0 )
@@ -1012,7 +1019,6 @@ bool FPakVFS::LoadPakIndex(FArchive* reader, const FPakInfo& info, FString& erro
1012
1019
reg.IndexInArchive = FileIndex;
1013
1020
E.FileInfo = RegisterFile (reg);
1014
1021
1015
- FileIndex++;
1016
1022
unguard;
1017
1023
}
1018
1024
unguard;
0 commit comments