[Bug 37128] New: Clang Static Analyzer: Uninitialized variable in a condition

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Aug 16 13:35:40 CDT 2014


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 at winehq.org
          Reporter: lukebenes at 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.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list