[Bug 37134] New: Clang Static Analyzer: Unreliable check

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Aug 16 13:42:33 CDT 2014


https://bugs.winehq.org/show_bug.cgi?id=37134

            Bug ID: 37134
           Summary: Clang Static Analyzer:  Unreliable check
           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 Unreliable check

File: dlls/advapi32/registry.c

Location: line 1209, column 13

Description: Array access (from variable 'str') results in a null pointer
dereference

LSTATUS WINAPI RegSetValueExW(...., const BYTE *data, .... )
{
  ...
  if (data && ((ULONG_PTR)data >> 16) == 0)
    //Assuming pointer value is null
    return ERROR_NOACCESS;

  if (count && is_string(type))
  {
    LPCWSTR str = (LPCWSTR)data;
    //Clang: 'str' initialized to a null pointer value
    if (str[count / sizeof(WCHAR) - 1] &&
        !str[count / sizeof(WCHAR)])
    //Clang: Array access (from variable 'str') results in
    //a null pointer dereference
        count += sizeof(WCHAR);
  }
  ...
}

If the null pointer data gets here, the program will go on executing until
addressing the str variable.

Another similar issue:

File: dlls/comctl32/comctl32undoc.c

Location: line 964, column 12

Description: Array access (from variable 'lpDest') results in a null pointer
dereference

-- 
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