Closed Bug 1236977 Opened 9 years ago Closed 9 years ago

clang-cl warning: cubeb_wasapi.cpp: variable 'devnode' is used uninitialized [-Wsometimes-uninitialized]

Categories

(Core :: Audio/Video: cubeb, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox44 --- unaffected
firefox45 --- affected
firefox46 --- fixed
firefox-esr38 --- unaffected

People

(Reporter: froydnj, Assigned: kinetik)

References

Details

Attachments

(1 file)

The error is: 48:13.85 c:/m-c/media/libcubeb/src/cubeb_wasapi.cpp(1549,7) : warning(clang): variable 'devnode' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] 48:13.85 if (FAILED(hr)) goto done; 48:13.85 ^~~~~~~~~~ 48:13.85 C:\Program Files (x86)\Windows Kits\8.1\include\shared\winerror.h(26237,20) : note(clang): expanded from macro 'FAILED' 48:13.85 #define FAILED(hr) (((HRESULT)(hr)) < 0) 48:13.85 ^~~~~~~~~~~~~~~~~~~~~ 48:13.85 c:/m-c/media/libcubeb/src/cubeb_wasapi.cpp(1626,15) : note(clang): uninitialized use occurs here 48:13.85 SafeRelease(devnode); 48:13.85 ^~~~~~~ 48:13.85 c:/m-c/media/libcubeb/src/cubeb_wasapi.cpp(1549,3) : note(clang): remove the 'if' if its condition is always false 48:13.85 if (FAILED(hr)) goto done; 48:13.86 ^~~~~~~~~~~~~~~~~~~~~~~~~ It looks like devnode is not initialized, but we can get to the |done:| label before it is. I think SafeRelease will be OK if we pass a garbage value to CloseHandle, but it'd be better to fix the bug so the compile doesn't complain. Filing this as s-s because this is media code and I'm not familiar with Windows; please open this up if it's really just a garden variety warning.
Group: core-security → media-core-security
This is new code added as part of the device enumeration work.
Blocks: 1225703
Attached patch bug1236977_v0.patch (deleted) — Splinter Review
Simple fix - initialize devnode to NULL.
Assignee: nobody → kinetik
Status: NEW → ASSIGNED
Attachment #8704477 - Flags: review?(padenot)
Attachment #8704477 - Flags: review?(padenot) → review+
This code is new and isn't actually used anywhere in Gecko yet. wasapi_create_device is internal and only called by wasapi_enumerate_devices, which is exposed as cubeb_enumerate_devices via the external API and is never called in Gecko code: http://mxr.mozilla.org/mozilla-central/search?string=cubeb_enumerate_devices So while the code is present in Firefox 45, I don't think we need to backport the fix. And because the code is not yet exposed in any way, I don't think we need to treat this as a security issue.
https://hg.mozilla.org/integration/mozilla-inbound/rev/dd7c4f457433d5a9f65a4a6007dbfe389081c248 Bug 1236977 - Default initialize IMMDevice temporary to avoid potential garbage CloseHandle on error. r=padenot
Group: media-core-security
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: