- Don't calculate remaining bits if there are none. Fixes out-of-bounds read of a buffer.

- Patch sent to Wine: http://www.winehq.org/pipermail/wine-patches/2008-December/066692.html

svn path=/trunk/; revision=38324
This commit is contained in:
Aleksey Bragin 2008-12-24 10:12:01 +00:00
parent ebef3e5d4e
commit 16726f509e

View file

@ -764,9 +764,12 @@ RtlNumberOfSetBits(PRTL_BITMAP BitMapHeader)
lpOut++; lpOut++;
} }
bMasked = *lpOut & NTDLL_maskBits[ulRemainder]; if (ulRemainder)
ulSet += NTDLL_nibbleBitCount[bMasked >> 4]; {
ulSet += NTDLL_nibbleBitCount[bMasked & 0xf]; bMasked = *lpOut & NTDLL_maskBits[ulRemainder];
ulSet += NTDLL_nibbleBitCount[bMasked >> 4];
ulSet += NTDLL_nibbleBitCount[bMasked & 0xf];
}
} }
return ulSet; return ulSet;
} }