From c80a5e014381c66ca5776294572a05fce1eb5e15 Mon Sep 17 00:00:00 2001 From: Maciej Bielski Date: Wed, 26 Jun 2024 13:44:42 +0000 Subject: [PATCH] fix: avoid dereferencing nullptr Related-To: NEO-11825 Signed-off-by: Maciej Bielski --- .../source/offline_compiler.cpp | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/shared/offline_compiler/source/offline_compiler.cpp b/shared/offline_compiler/source/offline_compiler.cpp index 115de7f8d5..98e0f6c982 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -423,11 +423,14 @@ int OfflineCompiler::queryAcronymIds(size_t numArgs, const std::vectorplatform.eProductFamily); - matchedVersions.push_back(ProductConfigHelper::parseMajorMinorRevisionValue(compilerProductHelper->getDefaultHwIpVersion())); - } else { + bool isMatched{false}; + if (auto hwInfoDepAcr = getHwInfoForDeprecatedAcronym(queryAcronym); hwInfoDepAcr) { + if (auto compilerProductHelper = NEO::CompilerProductHelper::create(hwInfoDepAcr->platform.eProductFamily); compilerProductHelper) { + matchedVersions.push_back(ProductConfigHelper::parseMajorMinorRevisionValue(compilerProductHelper->getDefaultHwIpVersion())); + isMatched = true; + } + } + if (!isMatched) { helper->printf("Error: Invalid command line. Unknown acronym %s.\n", allArgs[2].c_str()); retVal = OCLOC_INVALID_COMMAND_LINE; return retVal; @@ -1263,13 +1266,13 @@ Usage: ocloc [compile] -file -device [-output can be: %s - can be single target device. - -o Optional output file name. - Must not be used with: + -o Optional output file name. + Must not be used with: -gen_file | -cpp_file | -output_no_suffix | -output -output Optional output file base name. Default is input file's base name. - This base name will be used for all output files. + This base name will be used for all output files. For single target device proper suffixes (describing file formats) will be added automatically. @@ -1332,7 +1335,7 @@ Usage: ocloc [compile] -file -device [-output