ntdll: Fix buffer overread in RtlNumberOfSetBits.

This commit is contained in:
Aleksey Bragin 2008-12-24 06:04:25 +04:00 committed by Alexandre Julliard
parent 1b3feb2a5c
commit 4f74de5b36
1 changed files with 6 additions and 3 deletions

View File

@ -555,9 +555,12 @@ ULONG WINAPI RtlNumberOfSetBits(PCRTL_BITMAP lpBits)
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;
} }