Commit 4f74de5b authored by Aleksey Bragin's avatar Aleksey Bragin Committed by Alexandre Julliard

ntdll: Fix buffer overread in RtlNumberOfSetBits.

parent 1b3feb2a
......@@ -555,9 +555,12 @@ ULONG WINAPI RtlNumberOfSetBits(PCRTL_BITMAP lpBits)
lpOut++;
}
bMasked = *lpOut & NTDLL_maskBits[ulRemainder];
ulSet += NTDLL_nibbleBitCount[bMasked >> 4];
ulSet += NTDLL_nibbleBitCount[bMasked & 0xf];
if (ulRemainder)
{
bMasked = *lpOut & NTDLL_maskBits[ulRemainder];
ulSet += NTDLL_nibbleBitCount[bMasked >> 4];
ulSet += NTDLL_nibbleBitCount[bMasked & 0xf];
}
}
return ulSet;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment