Author: tfaber
Date: Mon Mar 31 19:57:42 2014
New Revision: 62591
URL:
http://svn.reactos.org/svn/reactos?rev=62591&view=rev
Log:
[RTL]
- Fix buffer overrun in RtlNumberOfSetBits
Modified:
trunk/reactos/lib/rtl/bitmap.c
Modified: trunk/reactos/lib/rtl/bitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=62591…
==============================================================================
--- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Mon Mar 31 19:57:42 2014
@@ -467,8 +467,11 @@
BitCount += BitCountTable[*Byte++];
}
- Shift = 8 - (BitMapHeader->SizeOfBitMap & 7);
- BitCount += BitCountTable[((*Byte) << Shift) & 0xFF];
+ if (BitMapHeader->SizeOfBitMap & 7)
+ {
+ Shift = 8 - (BitMapHeader->SizeOfBitMap & 7);
+ BitCount += BitCountTable[((*Byte) << Shift) & 0xFF];
+ }
return BitCount;
}