https://bugs.winehq.org/show_bug.cgi?id=37128
Bug ID: 37128 Summary: Clang Static Analyzer: Uninitialized variable in a condition Product: Wine Version: 1.7.22 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: lukebenes@hotmail.com
Clang Static Analyzer identifies Uninitialized variable in a condition
File: dlls/atl110/../atl/atl_ax.c
Location: line 1092, column 10
Description: Branch condition evaluates to a garbage value
HRESULT WINAPI AtlAxCreateControlEx(LPCOLESTR lpszName, HWND hWnd, IStream *pStream, IUnknown **ppUnkContainer, IUnknown **ppUnkControl, REFIID iidSink, IUnknown *punkSink) { ... IUnknown *pContainer; ... hRes = AtlAxAttachControl( pUnkControl, hWnd, &pContainer ); if ( FAILED( hRes ) ) WARN("cannot attach control to window\n"); ... if ( pContainer ) //<== //Clang: Branch condition evaluates to a garbage value IUnknown_Release( pContainer ); return S_OK; }
The uninitialized variable pContainer is used in the condition after the call of AtlAxAttachControl. This function's description is given below.
HRESULT WINAPI AtlAxAttachControl(IUnknown *control, HWND hWnd, IUnknown **container) { HRESULT hr; ... if (!control) return E_INVALIDARG;//<== hr = IOCS_Create( hWnd, control, container ); return hWnd ? hr : S_FALSE; }
In this code, the E_INVALIDARG value may be returned before initializing the container variable. It will result in the AtlAxCreateControlEx function generating the warning and going on to work with the uninitialized variable.
https://bugs.winehq.org/show_bug.cgi?id=37128
--- Comment #1 from Luke lukebenes@hotmail.com --- Created attachment 49348 --> https://bugs.winehq.org/attachment.cgi?id=49348 clang error report
https://bugs.winehq.org/show_bug.cgi?id=37128
--- Comment #2 from Luke lukebenes@hotmail.com --- Created attachment 49349 --> https://bugs.winehq.org/attachment.cgi?id=49349 clang error report
https://bugs.winehq.org/show_bug.cgi?id=37128
--- Comment #3 from Luke lukebenes@hotmail.com --- Created attachment 49350 --> https://bugs.winehq.org/attachment.cgi?id=49350 clang error report
https://bugs.winehq.org/show_bug.cgi?id=37128
--- Comment #4 from Austin English austinenglish@gmail.com --- This is your friendly reminder that there has been no bug activity for over a year. Is this still an issue in current (1.7.51 or newer) wine?
https://bugs.winehq.org/show_bug.cgi?id=37128
Kirill K. Smirnov kirill.k.smirnov@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |kirill.k.smirnov@gmail.com
--- Comment #5 from Kirill K. Smirnov kirill.k.smirnov@gmail.com --- It seems bug is fixed. The uninitialized variable is now NULL (atl/atl_ax.c:1053) and clang analyzer does not complain too.
commit ec52a1f55700989f014851eef0a25641f8bc983a Author: Qian Hong qhong@codeweavers.com Date: Fri Jan 16 16:09:36 2015 +0800
atl: Improved content type handling of AtlAxCreateControlEx.
https://bugs.winehq.org/show_bug.cgi?id=37128
super_man@post.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |00cpxxx@gmail.com, | |super_man@post.com
https://bugs.winehq.org/show_bug.cgi?id=37128
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED Component|-unknown |atl Summary|Clang Static Analyzer: |Clang: Uninitialized |Uninitialized variable in a |variable in a condition in |condition |atl_ax.c Fixed by SHA1| |ec52a1f55700989f014851eef0a | |25641f8bc983a
--- Comment #6 from Bruno Jesus 00cpxxx@gmail.com --- (In reply to Kirill K. Smirnov from comment #5)
It seems bug is fixed. The uninitialized variable is now NULL (atl/atl_ax.c:1053) and clang analyzer does not complain too.
commit ec52a1f55700989f014851eef0a25641f8bc983a Author: Qian Hong qhong@codeweavers.com Date: Fri Jan 16 16:09:36 2015 +0800
atl: Improved content type handling of AtlAxCreateControlEx.
Assuming fixed.
https://bugs.winehq.org/show_bug.cgi?id=37128
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.9.13.