Skip to content

Commit ed4462c

Browse files
committed
Fix out-of-bounds array access in hFlipBit.
A use of `setByteArray`was writing outside of the byte array bounds. This is now fixed.
1 parent 72c4461 commit ed4462c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/Test/Util/FS.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ hFlipBit hfs h bitOffset = do
364364
-- least the size of a machine word.
365365
let n = sizeOf (0 :: Word)
366366
buf <- newPinnedByteArray n
367-
setByteArray buf 0 n (0 :: Word)
367+
setByteArray buf 0 1 (0 :: Word)
368368
-- Read the bit at the given offset
369369
let (byteOffset, i) = bitOffset `quotRem` 8
370370
bufOff = BufferOffset 0

0 commit comments

Comments
 (0)