Fail on out-of-range CPU number

Found by Coverity
This commit is contained in:
Christian Göttsche 2020-08-28 15:26:28 +02:00
parent df41979afc
commit af84d3dfa9
1 changed files with 1 additions and 1 deletions

View File

@ -1235,7 +1235,7 @@ static inline double LinuxProcessList_scanCPUFrequency(LinuxProcessList* this) {
(sscanf(buffer, "cpu MHz : %lf", &frequency) == 1) ||
(sscanf(buffer, "cpu MHz: %lf", &frequency) == 1)
) {
if (cpuid < 0) {
if (cpuid < 0 || cpuid > (cpus - 1)) {
CRT_fatalError(PROCCPUINFOFILE " is malformed: cpu MHz line without corresponding processor line");
}