From f5b9a95522524eb381d05bc8e8e0c6f57ca0c7fc Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 5 Jan 2021 14:15:32 +0100 Subject: [PATCH] Fix null character at shader sources at during game cooking --- Source/Editor/Cooker/Steps/CookAssetsStep.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Editor/Cooker/Steps/CookAssetsStep.cpp b/Source/Editor/Cooker/Steps/CookAssetsStep.cpp index af6f003b8..7f2824c42 100644 --- a/Source/Editor/Cooker/Steps/CookAssetsStep.cpp +++ b/Source/Editor/Cooker/Steps/CookAssetsStep.cpp @@ -323,6 +323,8 @@ bool ProcessShaderBase(CookAssetsStep::AssetCookData& data, ShaderAssetBase* ass auto sourceLength = sourceChunk->Size(); Encryption::DecryptBytes((byte*)source, sourceLength); source[sourceLength - 1] = 0; + while (sourceLength > 2 && source[sourceLength - 1] == 0) + sourceLength--; // Init shader cache output stream // TODO: reuse MemoryWriteStream per cooking process to reduce dynamic memory allocations