WebKit Bugzilla
Attachment 342924 Details for
Bug 186757
: Properly check the sscanf return value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186757-20180618131550.patch (text/plain), 1.84 KB, created by
Tomas Popela
on 2018-06-18 04:15:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tomas Popela
Created:
2018-06-18 04:15:51 PDT
Size:
1.84 KB
patch
obsolete
>Subversion Revision: 232922 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b2eec5a83d179a43a81116da798a1276d4d91a13..bb9e73a65114494a6c00fa09101355d397331dbf 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,16 @@ >+2018-06-18 Tomas Popela <tpopela@redhat.com> >+ >+ Properly check the sscanf return valua >+ https://bugs.webkit.org/show_bug.cgi?id=186757 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Check if we matched anything and if we matched the expected amount of >+ data. >+ >+ * page/linux/ResourceUsageThreadLinux.cpp: >+ (WebCore::cpuPeriod): >+ > 2018-06-18 Tomas Popela <tpopela@redhat.com> > > [GTK] Wrong variable used in RenderThemeGtk >diff --git a/Source/WebCore/page/linux/ResourceUsageThreadLinux.cpp b/Source/WebCore/page/linux/ResourceUsageThreadLinux.cpp >index d9e4179072dfc614b18ec681668d6fe090c079d0..b1f51e14f6ffbf3d4ab829a6d33131fb1d7155c1 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;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186757
: 342924