[2024.01.25-14.38.45:392][359]LogRuntimeArchiver: Error: ERuntimeArchiverErrorCode::ExtractError: Unable to extract zip entry 'SaveGameInfoJSON.txt' into memory.
Miniz error details: 'invalid header or archive is corrupted'.
the issue is this:
i am using
UFUNCTION(BlueprintCallable, Category = "Runtime Archiver|Open")
bool OpenArchiveFromMemory(TArray<uint8> ArchiveData);
but there are several problems with this function as written:
1 - it makes a temporary copy of the archive data
2 - it makes a second temporary copy in
bool URuntimeArchiverBase::OpenArchiveFromMemory(TArray<uint8> ArchiveData)
{
return OpenArchiveFromMemory(TArray64<uint8>(MoveTemp(ArchiveData)));
}
that copy gets destructed on the way out of OpenArchiveFromMemory, which ends up freeing the memory for the temporary copy and overwriting the first four bytes of the archive data
that makes the first file unreadable, of course ( it appears corrupted because it is missing a proper signature ) but of course the problem is worse than that since the whole block has been free and a raw pointer to it stored in MinizArchiver->m_pState.m_pMem
I can hack arounds this by changing
UFUNCTION(BlueprintCallable, Category = "Runtime Archiver|Open")
bool OpenArchiveFromMemory(const TArray<uint8> &ArchiveData);
and
bool URuntimeArchiverBase::OpenArchiveFromMemory(const TArray<uint8> &ArchiveData)
{
const TArrayView64<const uint8> ArchiveData64( (const uint8 *) ArchiveData.GetData(), ArchiveData.Num());
return OpenArchiveFromMemory(*reinterpret_cast<const TArray64<uint8>*>(&ArchiveData64));
}
but that is kind of a rickety abomination