mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
fix: remove potential string's internal buffer overlaping if resized
Related-To: NEO-10767 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8257c0870d
commit
92ea7ee7a3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
* Copyright (C) 2020-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -52,7 +52,8 @@ zeIntelGetDriverVersionString(
|
||||
L0::DriverHandle::fromHandle(toInternalType(hDriver))->getApiVersion(&apiVersion);
|
||||
std::string driverVersionString = std::to_string(ZE_MAJOR_VERSION(apiVersion)) + "." + std::to_string(ZE_MINOR_VERSION(apiVersion)) + "." + std::to_string(NEO_VERSION_BUILD);
|
||||
if (NEO_VERSION_HOTFIX > 0) {
|
||||
driverVersionString += "+" + std::to_string(NEO_VERSION_HOTFIX);
|
||||
driverVersionString.append("+");
|
||||
driverVersionString.append(std::to_string(NEO_VERSION_HOTFIX));
|
||||
}
|
||||
if (*pVersionSize == 0) {
|
||||
*pVersionSize = strlen(driverVersionString.c_str());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
* Copyright (C) 2023-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "shared/source/program/program_info.h"
|
||||
#include "shared/source/utilities/const_stringref.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace NEO::Zebin::ZeInfo {
|
||||
|
||||
template <typename ContainerT>
|
||||
@@ -105,7 +107,9 @@ DecodeError extractZeInfoKernelSections(const NEO::Yaml::YamlParser &parser, con
|
||||
} else if (Tags::Kernel::inlineSamplers == key) {
|
||||
outZeInfoKernelSections.inlineSamplersNd.push_back(&kernelMetadataNd);
|
||||
} else {
|
||||
encounterUnknownZeInfoAttribute("\"" + parser.readKey(kernelMetadataNd).str() + "\" in context of : " + context.str(), outErrReason, outWarning, err);
|
||||
std::ostringstream entryStream;
|
||||
entryStream << "\"" << parser.readKey(kernelMetadataNd).str() << "\" in context of : " << context.str();
|
||||
encounterUnknownZeInfoAttribute(entryStream.str(), outErrReason, outWarning, err);
|
||||
}
|
||||
}
|
||||
return err;
|
||||
@@ -207,7 +211,9 @@ DecodeError readZeInfoGlobalHostAceessTable(const NEO::Yaml::YamlParser &parser,
|
||||
} else if (Tags::GlobalHostAccessTable::hostName == key) {
|
||||
validTable &= readZeInfoValueChecked(parser, globalHostAccessNameMemberNd, globalHostAccessMetadata.hostName, context, outErrReason);
|
||||
} else {
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" for payload argument in context of " + context.str(), outErrReason, outWarning, err);
|
||||
std::ostringstream entry;
|
||||
entry << "\"" << key.str() << "\" for payload argument in context of " << context.str();
|
||||
encounterUnknownZeInfoAttribute(entry.str(), outErrReason, outWarning, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -789,7 +795,9 @@ DecodeError readZeInfoAttributes(const Yaml::YamlParser &parser, const Yaml::Nod
|
||||
} else if (key.contains(Tags::Kernel::Attributes::hintSuffix.data())) {
|
||||
outAttributes.otherHints.push_back({key, parser.readValue(attributesMetadataNd)});
|
||||
} else {
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" in context of " + context.str(), outErrReason, outWarning, err);
|
||||
std::ostringstream entry;
|
||||
entry << "\"" << key.str() << "\" in context of " << context.str();
|
||||
encounterUnknownZeInfoAttribute(entry.str(), outErrReason, outWarning, err);
|
||||
}
|
||||
}
|
||||
return validAttributes ? err : DecodeError::invalidBinary;
|
||||
@@ -860,7 +868,9 @@ DecodeError readZeInfoDebugEnvironment(const Yaml::YamlParser &parser, const Yam
|
||||
} else if (Tags::Kernel::DebugEnv::debugSurfaceOffset == key) {
|
||||
validDebugEnv &= readZeInfoValueChecked(parser, debugEnvNd, outDebugEnv.debugSurfaceOffset, context, outErrReason);
|
||||
} else {
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" in context of " + context.str(), outErrReason, outWarning, err);
|
||||
std::ostringstream entry;
|
||||
entry << "\"" << key.str() << "\" in context of " << context.str();
|
||||
encounterUnknownZeInfoAttribute(entry.str(), outErrReason, outWarning, err);
|
||||
}
|
||||
}
|
||||
return validDebugEnv ? err : DecodeError::invalidBinary;
|
||||
@@ -907,11 +917,15 @@ DecodeError readZeInfoPerThreadPayloadArguments(const Yaml::YamlParser &parser,
|
||||
} else if (Tags::Kernel::PerThreadPayloadArgument::offset == key) {
|
||||
validPerThreadPayload &= readZeInfoValueChecked(parser, perThreadPayloadArgumentMemberNd, perThreadPayloadArgMetadata.offset, context, outErrReason);
|
||||
} else {
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" for per-thread payload argument in context of " + context.str(), outErrReason, outWarning, err);
|
||||
std::ostringstream entry;
|
||||
entry << "\"" << key.str() << "\" for per-thread payload argument in context of " << context.str();
|
||||
encounterUnknownZeInfoAttribute(entry.str(), outErrReason, outWarning, err);
|
||||
}
|
||||
}
|
||||
if (0 == perThreadPayloadArgMetadata.size) {
|
||||
outWarning.append("DeviceBinaryFormat::zebin::.ze_info : Skippinig 0-size per-thread argument of type : " + argTypeStr.str() + " in context of " + context.str() + "\n");
|
||||
std::ostringstream entry;
|
||||
entry << "DeviceBinaryFormat::zebin::.ze_info : Skippinig 0-size per-thread argument of type : " << argTypeStr.str() << " in context of " << context.str() << "\n";
|
||||
outWarning.append(entry.str());
|
||||
outPerThreadPayloadArguments.pop_back();
|
||||
}
|
||||
}
|
||||
@@ -1101,7 +1115,9 @@ DecodeError readZeInfoPayloadArguments(const Yaml::YamlParser &parser, const Yam
|
||||
} else if (Tags::Kernel::PayloadArgument::btiValue == key) {
|
||||
validPayload &= readZeInfoValueChecked(parser, payloadArgumentMemberNd, payloadArgMetadata.btiValue, context, outErrReason);
|
||||
} else {
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" for payload argument in context of " + context.str(), outErrReason, outWarning, err);
|
||||
std::ostringstream entry;
|
||||
entry << "\"" << key.str() << "\" for payload argument in context of " << context.str();
|
||||
encounterUnknownZeInfoAttribute(entry.str(), outErrReason, outWarning, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1505,7 +1521,9 @@ DecodeError readZeInfoInlineSamplers(const Yaml::YamlParser &parser, const Yaml:
|
||||
} else if (Tags::normalized == key) {
|
||||
validInlineSamplers &= readZeInfoValueChecked(parser, inlineSamplerMemberNd, inlineSampler.normalized, context, outErrReason);
|
||||
} else {
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" for inline sampler in context of " + context.str(), outErrReason, outWarning, err);
|
||||
std::ostringstream entry;
|
||||
entry << "\"" << key.str() << "\" for inline sampler in context of " << context.str();
|
||||
encounterUnknownZeInfoAttribute(entry.str(), outErrReason, outWarning, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1592,7 +1610,9 @@ DecodeError readZeInfoPerThreadMemoryBuffers(const Yaml::YamlParser &parser, con
|
||||
} else if (Tags::Kernel::PerThreadMemoryBuffer::slot == key) {
|
||||
validBuffer &= readZeInfoValueChecked(parser, perThreadMemoryBufferMemberNd, perThreadMemoryBufferMetadata.slot, context, outErrReason);
|
||||
} else {
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" for per-thread memory buffer in context of " + context.str(), outErrReason, outWarning, err);
|
||||
std::ostringstream entry;
|
||||
entry << "\"" << key.str() << "\" for per-thread memory buffer in context of " << context.str();
|
||||
encounterUnknownZeInfoAttribute(entry.str(), outErrReason, outWarning, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1679,7 +1699,9 @@ DecodeError readZeInfoExperimentalProperties(const Yaml::YamlParser &parser, con
|
||||
validExperimentalProperty &= readZeInfoValueChecked(parser, experimentalPropertyMemberNd,
|
||||
outExperimentalProperties.hasNonKernelArgAtomic, context, outErrReason);
|
||||
} else {
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" in context of " + context.str(), outErrReason, outWarning, err);
|
||||
std::ostringstream entry;
|
||||
entry << "\"" << key.str() << "\" in context of " << context.str();
|
||||
encounterUnknownZeInfoAttribute(entry.str(), outErrReason, outWarning, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1723,7 +1745,9 @@ DecodeError readZeInfoBindingTableIndices(const Yaml::YamlParser &parser, const
|
||||
} else if (Tags::Kernel::BindingTableIndex::btiValue == key) {
|
||||
validBindingTableEntries &= readZeInfoValueChecked(parser, bindingTableIndexMemberNd, bindingTableIndexMetadata.btiValue, context, outErrReason);
|
||||
} else {
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" for binding table index in context of " + context.str(), outErrReason, outWarning, err);
|
||||
std::ostringstream entryStream;
|
||||
entryStream << "\"" << key.str() << "\" for binding table index in context of " << context.str();
|
||||
encounterUnknownZeInfoAttribute(entryStream.str(), outErrReason, outWarning, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
* Copyright (C) 2024-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,10 +7,14 @@
|
||||
|
||||
#include "shared/source/device_binary_format/zebin/zeinfo_decoder.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace NEO::Zebin::ZeInfo {
|
||||
void readZeInfoValueCheckedExtra(const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &execEnvMetadataNd, KernelExecutionEnvBaseT &kernelExecEnv, ConstStringRef context,
|
||||
ConstStringRef key, std::string &outErrReason, std::string &outWarning, bool &validExecEnv, DecodeError &error) {
|
||||
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" in context of " + context.str(), outErrReason, outWarning, error);
|
||||
std::ostringstream entry;
|
||||
entry << "\"" << key.str() << "\" in context of " << context.str();
|
||||
encounterUnknownZeInfoAttribute(entry.str(), outErrReason, outWarning, error);
|
||||
}
|
||||
} // namespace NEO::Zebin::ZeInfo
|
||||
|
||||
Reference in New Issue
Block a user