[PATCH] d3dx9_36: Fixed memset of a -2 32bit value (Coverity)
Michael Mc Donnell
michael at mcdonnell.dk
Sun Aug 7 06:30:22 CDT 2011
On Sat, Aug 6, 2011 at 1:13 PM, Marcus Meissner <marcus at jet.franken.de> wrote:
> You can't memset entities larger than bytes.
Thanks for patching that. It's not critical as I just needed a large
value that wasn't 0xFFFFFFFF. Here -2 would be converted into
0xFEFEFEFE, which is also a larger value :-) Your patch sets it to
0xFFFFFFFE which is nicer.
> (Also this code passes negative values via DWORDs, which are unsigned, which
> probably is also incorrect. But I am leaving that as-is.)
I don't see why it would be incorrect. This is how it's done on
Windows too. It's using two's complement. I'd be happy to change it
if someone could show me a situation where it doesn't work.
> -1 is semi-safe, but only due to the nature of the negative representation. Fix it too.
Would using a const DWORD DWORD_MAX set to 4294967295 instead of -1
silence Coverity?
Thanks,
Michael Mc Donnell
More information about the wine-patches
mailing list