Closed lehins closed 4 years ago
It looks like the maxBound is quite small:
ord (maxBound :: Char)
1114111
Certainly smaller than 31 bits:
logBase 2 $ fromIntegral $ ord (maxBound :: Char)
20.087461546321563
What happens if you pass a 2147483647
to readWideCharOffAddr#
?
@lehins I opened https://github.com/NorfairKing/validity/pull/79/files Could you have a look?
This has been implemented in the layest release
Currently in
validity
Char
is trivially valid. But if you check thechr
function it is expected to be:While when read from memory only 31 bits are expected:
readWideCharOffAddr#
In other words I can construct an invalid
Char#
that can mess things up:In fact it is possible to construct even larger 64bit
Char
s that are ven negative :slightly_smiling_face: