diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2020-03-17 13:55:39 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-03-19 12:16:54 -0400 |
commit | cb1785d9f839e34a3a4892f354f0c51cc6553c0e (patch) | |
tree | bc01707dbe682c3e1f755b3d41f8062c7c264db1 /testsuite/tests/polykinds | |
parent | 64f207566931469648e791df4f0f0384d45cddd0 (diff) | |
download | haskell-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 'testsuite/tests/polykinds')
0 files changed, 0 insertions, 0 deletions