Description

This problem is caused by an incorrect calculation of the number of chunks in the read request.
Here is the workaround applied by the licensee :

int64 FSignedArchiveReader::PrecacheChunks(TArray<FSignedArchiveReader::FReadInfo>& Chunks, int64 Length, FEvent* Event)
{
	SCOPE_SECONDS_ACCUMULATOR(STAT_SignedArchiveReader_PreCacheChunks);

	// Request all the chunks that are needed to complete this read
	int64 DataOffset;
	int64 DestOffset = 0;
	int32 FirstChunkIndex = CalculateChunkIndex(PakOffset);
	int64 ChunkStartOffset = CalculateChunkOffset(PakOffset, DataOffset);
	//int64 NumChunksForRequest = (DataOffset - ChunkStartOffset + Length) / FPakInfo::MaxChunkDataSize + 1;
	int64 NumChunksForRequest = ((DataOffset - ChunkStartOffset + Length) + FPakInfo::MaxChunkDataSize - 1) / FPakInfo::MaxChunkDataSize; // workaround
Steps to Reproduce

1. Execute a read request whose end of the read request matches the 64KB chunk boundary.

Result:

Engine may report read requests beyond the end of Pak :

LogFileManager: Error: Requested read of 65536 bytes when 0 bytes remain (file=***.pak, size=9306112)​

Then ensure condition failed occurs (see callstack)

Ensure condition failed: 0 [File:***/Engine/Source/Runtime/Core/Private/Windows/WindowsErrorOutputDevice.cpp] [Line: 47]
Callstack
***-Win64-Test.exe!<lambda_0116df3e6b0fa3cfdd92845ff75013da>::operator()() [***\Engine\Source\Runtime\Core\Private\Windows\WindowsErrorOutputDevice.cpp:47]
***-Win64-Test.exe!FWindowsErrorOutputDevice::Serialize() [***\Engine\Source\Runtime\Core\Private\Windows\WindowsErrorOutputDevice.cpp:47]
***-Win64-Test.exe!FOutputDevice::LogfImpl() [***\Engine\Source\Runtime\Core\Private\Misc\OutputDevice.cpp:61]
***-Win64-Test.exe!AssertFailedImplV() [***\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:104]
***-Win64-Test.exe!FDebug::CheckVerifyFailedImpl() [***\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:461]
***-Win64-Test.exe!DispatchCheckVerify<void,<lambda_dd40a3e0e702ca0fcc8f8ff8fc953680> >() [***\Engine\Source\Runtime\Core\Public\Misc\AssertionMacros.h:165]
***-Win64-Test.exe!FChunkCacheWorker::CheckSignature() [***\Engine\Source\Runtime\PakFile\Private\SignedArchiveReader.cpp:265]
***-Win64-Test.exe!FChunkCacheWorker::ProcessQueue() [***\Engine\Source\Runtime\PakFile\Private\SignedArchiveReader.cpp:217]
***-Win64-Test.exe!FChunkCacheWorker::Run() [***\Engine\Source\Runtime\PakFile\Private\SignedArchiveReader.cpp:70]
***-Win64-Test.exe!FRunnableThreadWin::Run() [***\Engine\Source\Runtime\Core\Private\Windows\WindowsRunnableThread.cpp:86]
***-Win64-Test.exe!FRunnableThreadWin::GuardedRun() [***\Engine\Source\Runtime\Core\Private\Windows\WindowsRunnableThread.cpp:35]
KERNEL32.DLL!UnknownFunction []
ntdll.dll!UnknownFunction []

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-168199 in the post.

0
Login to Vote

Fixed
ComponentUE - Foundation - Core
Affects Versions4.275.05.1
Target Fix5.1.1
Fix Commit22806755
Main Commit22806755
Release Commit23388031
CreatedOct 25, 2022
ResolvedOct 28, 2022
UpdatedDec 14, 2022