summaryrefslogtreecommitdiff
path: root/distrib/compare/Change.hs
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2020-03-17 13:55:39 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-19 12:16:54 -0400
commitcb1785d9f839e34a3a4892f354f0c51cc6553c0e (patch)
treebc01707dbe682c3e1f755b3d41f8062c7c264db1 /distrib/compare/Change.hs
parent64f207566931469648e791df4f0f0384d45cddd0 (diff)
downloadhaskell-cb1785d9f839e34a3a4892f354f0c51cc6553c0e.tar.gz
FastString: fix eager reading of string ptr in hashStr
This read causes NULL dereferencing when len is 0. Fixes #17909 In the reproducer in #17909 this bug is triggered as follows: - SimplOpt.dealWithStringLiteral is called with a single-char string ("=" in #17909) - tailFS gets called on the FastString of the single-char string. - tailFS checks the length of the string, which is 1, and calls mkFastStringByteString on the tail of the ByteString, which is an empty ByteString as the original ByteString has only one char. - ByteString's unsafeUseAsCStringLen returns (NULL, 0) for the empty ByteString, which is passed to mkFastStringWith. - mkFastStringWith gets hash of the NULL pointer via hashStr, which fails on empty strings because of this bug.
Diffstat (limited to 'distrib/compare/Change.hs')
0 files changed, 0 insertions, 0 deletions