- Fix apitest crashes in RtlFindClearBits/RtlFindSetBits

svn path=/trunk/; revision=62691
This commit is contained in:
Thomas Faber
2014-04-08 21:04:47 +00:00
parent e2ce9d5f37
commit b7eda79879
+10
View File
@@ -101,6 +101,11 @@ RtlpGetLengthOfRunClear(
BITMAP_INDEX Value, BitPos, Length;
PBITMAP_BUFFER Buffer, MaxBuffer;
/* If we are already at the end, the length of the run is zero */
ASSERT(StartingIndex <= BitMapHeader->SizeOfBitMap);
if (StartingIndex >= BitMapHeader->SizeOfBitMap)
return 0;
/* Calculate positions */
Buffer = BitMapHeader->Buffer + StartingIndex / _BITCOUNT;
BitPos = StartingIndex & (_BITCOUNT - 1);
@@ -150,6 +155,11 @@ RtlpGetLengthOfRunSet(
BITMAP_INDEX InvValue, BitPos, Length;
PBITMAP_BUFFER Buffer, MaxBuffer;
/* If we are already at the end, the length of the run is zero */
ASSERT(StartingIndex <= BitMapHeader->SizeOfBitMap);
if (StartingIndex >= BitMapHeader->SizeOfBitMap)
return 0;
/* Calculate positions */
Buffer = BitMapHeader->Buffer + StartingIndex / _BITCOUNT;
BitPos = StartingIndex & (_BITCOUNT - 1);