[Bug 37123] New: PVS-Studio Error: Double type conversion

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Aug 16 13:21:07 CDT 2014


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

            Bug ID: 37123
           Summary: PVS-Studio Error: Double type conversion
           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

PVS-Studio identifies a Double type conversion Error.



The *void pointer is cast to other types twice: first to char*, then to DWORD*,
after which an offset is added. Either the expression lacks parentheses or the
code is excessive. Whether or not there is an error here depends on how much
the programmer wanted to increment the pointer.

V650 Type casting operation is utilized 2 times in succession. Next, the '+'
operation is executed. Probably meant: (T1)((T2)a + b). typelib.c 9147

...
struct WMSFT_SegContents arraydesc_seg;
typedef struct tagWMSFT_SegContents {
    DWORD len;
    void *data;
} WMSFT_SegContents;
...
DWORD offs = file->arraydesc_seg.len;
DWORD *encoded;
encoded = (DWORD*)((char*)file->arraydesc_seg.data) + offs;//<==

Another similar issue:

V650 Type casting operation is utilized 2 times in succession. Next, the '+'
operation is executed. Probably meant: (T1)((T2)a + b). protocol.c 194

INT WINAPI
EnumProtocolsW(LPINT protocols, LPVOID buffer, LPDWORD buflen)
{
  ...
  unsigned int string_offset;
  ...
  pi[i].lpProtocol = (WCHAR*)(char*)buffer + string_offset;//<==
  ...
}


details on the V650 error here: http://www.viva64.com/en/d/0269/

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