Add fix to check for vector size while reading pp_dpm_pcie
pop_back() was causing a seg fault when pp_dpm_pcie file is empty and returns whitespace.
Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: I888f1f79751cd456e43751a5b96d08560a039677
[ROCm/rocm_smi_lib commit: ec71380e1c]
Этот коммит содержится в:
@@ -630,7 +630,7 @@ int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr) {
|
||||
ret = RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
fs.close();
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -742,7 +742,8 @@ int Device::readDevInfoMultiLineStr(DevInfoTypes type,
|
||||
return 0;
|
||||
}
|
||||
// Remove any *trailing* empty (whitespace) lines
|
||||
while (retVec->back().find_first_not_of(" \t\n\v\f\r") == std::string::npos) {
|
||||
while (retVec->size() != 0 &&
|
||||
retVec->back().find_first_not_of(" \t\n\v\f\r") == std::string::npos) {
|
||||
retVec->pop_back();
|
||||
}
|
||||
return 0;
|
||||
|
||||
Ссылка в новой задаче
Block a user