[Bug 37124] New: PVS-Studio Error: Difference of unsigned numbers

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Aug 16 13:23:24 CDT 2014


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

            Bug ID: 37124
           Summary: PVS-Studio Error: Difference of unsigned numbers
           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 Difference of unsigned numbers. V555 The expression
'This->nStreams - nr > 0' will work as 'This->nStreams != nr'. editstream.c 172

static HRESULT
AVIFILE_RemoveStream(IAVIEditStreamImpl* const This, DWORD nr)
{
  ...
  This->nStreams--;
  if (This->nStreams - nr > 0) { //<==
    memmove(This->pStreams + nr, This->pStreams + nr + 1,
            (This->nStreams - nr) * sizeof(EditStreamTable));
  }
  ...
}

The nr variable has the unsigned type DWORD. Subtracting it will result in an
unsigned value, too. If nr is larger than This->nStreams, then the condition
will still be true.

A similar issue:

V555 The expression 'This->fInfo.dwStreams - nStream > 0' will work as
'This->fInfo.dwStreams != nStream'. avifile.c 469


details on the V555 error here: http://www.viva64.com/en/d/0146/

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