Closed
Bug 1174465
Opened 11 years ago
Closed 11 years ago
CpuSampler::GetSystemLoad uses incorrect sscanf arguments
Categories
(Core :: WebRTC, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: q1, Unassigned)
Details
CpuSampler::GetSystemLoad (38.0.1\media\webrtc\trunk\webrtc\base\cpumonitor.cc line 165) uses incorrect sscanf arguments at line 262:
258: unsigned long long user;
259: unsigned long long nice;
260: unsigned long long system;
261: unsigned long long idle;
262: if (sscanf(statbuf.c_str(), "cpu %Lu %Lu %Lu %Lu",
263: &user, &nice,
264: &system, &idle) != 4) {
265: LOG_ERR(LS_ERROR) << "Could not parse cpu info";
266: return 0.f;
267: }
"%Lu" is an invalid format specifier. Experiment shows that VC 2010 ignores the "L", and sets only the lower halves of the output arguments.
Probably the appropriate specifier is "%I64u" or "%lld", though there might still be a signed/unsigned issue there.
This bug does not appear to have any security consequences. I have marked it as a security bug only because I have already publicly reported one nonsecurity sscanf issue (https://bugzilla.mozilla.org/show_bug.cgi?id=1174455 ) and expect to find more, and I don't want to suggest to the wide world that it would be profitable to scan the code for them.
Updated•11 years ago
|
Component: Untriaged → WebRTC
Product: Firefox → Core
Comment 1•11 years ago
|
||
We don't compile or use cpumonitor.cc - it's in an upstream imported package, and is part of "rtc_base" in gyp, not "rtc_base_approved" which is what we use from 'base'.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
I suggest adding a #error directive to this code so that no one accidentally introduces a bug later.
Resolution: INVALID → FIXED
That's odd: why did the status change from "invalid" to "fixed"?
Updated•11 years ago
|
Group: core-security → core-security-release
Updated•10 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•