You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
1.1 KiB
21 lines
1.1 KiB
6 years ago
|
diff --git a/Source/WebCore/page/linux/ResourceUsageThreadLinux.cpp b/Source/WebCore/page/linux/ResourceUsageThreadLinux.cpp
|
||
|
index d9e4179072d..b1f51e14f6f 100644
|
||
|
--- a/Source/WebCore/page/linux/ResourceUsageThreadLinux.cpp
|
||
|
+++ b/Source/WebCore/page/linux/ResourceUsageThreadLinux.cpp
|
||
|
@@ -58,8 +58,14 @@ static float cpuPeriod()
|
||
|
unsigned long long userTime, niceTime, systemTime, idleTime;
|
||
|
unsigned long long ioWait, irq, softIrq, steal, guest, guestnice;
|
||
|
ioWait = irq = softIrq = steal = guest = guestnice = 0;
|
||
|
- sscanf(buffer, "cpu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu",
|
||
|
+ int retVal = sscanf(buffer, "cpu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu",
|
||
|
&userTime, &niceTime, &systemTime, &idleTime, &ioWait, &irq, &softIrq, &steal, &guest, &guestnice);
|
||
|
+ // We expect 10 values to be matched by sscanf
|
||
|
+ if (retVal < 10 || retVal == EOF) {
|
||
|
+ fclose(file);
|
||
|
+ return 0;
|
||
|
+ }
|
||
|
+
|
||
|
|
||
|
// Keep parsing if we still don't know cpuCount.
|
||
|
static unsigned cpuCount = 0;
|