Limit access to the printf buffer

Change-Id: Ic212f66ebedc374316c4ad8e32b708ae445f2276
Signed-off-by: Koska <andrzej.koska@intel.com>
Related-To: NEO-4595
This commit is contained in:
Koska
2020-04-28 17:05:39 +02:00
committed by sys_ocldev
parent f5211fa0bd
commit 68f7e67e31
2 changed files with 18 additions and 1 deletions

View File

@@ -25,7 +25,9 @@ void PrintFormatter::printKernelOutput(const std::function<void(char *)> &print)
currentOffset = 0;
// first 4 bytes of the buffer store the actual size of data that was written by printf from within EUs
read(&printfOutputBufferSize);
uint32_t printfOutputBufferSizeRead = 0;
read(&printfOutputBufferSizeRead);
printfOutputBufferSize = std::min(printfOutputBufferSizeRead, printfOutputBufferSize);
uint32_t stringIndex = 0;
while (currentOffset + 4 <= printfOutputBufferSize) {