[Haskell-cafe] Re: user error when using Text.Regex.PCRE

ChrisK haskell at list.mightyreason.com
Tue Nov 20 09:36:43 EST 2007

Thank you very much for the error report.  I have tracked down the cause.

You are searching against an empty Bytestring.  This is now represented by

> -- | /O(1)/ The empty 'ByteString'
> empty :: ByteString
> empty = PS nullForeignPtr 0 0

And while the useAsCString and useAsCStringLen functions never reveal the null
pointer, the current library uses unsafeUseAsCStringLen, which returns the null

And this is getting caught by a null pointer check resulting in your crash.  I
will post a fix later tonight, and announce it.

Which regex-prce version are you using?  Perhaps from hackage?  I want to
prioritize the version you need fixed.

The earlier repository holds up to version 0.81 at
The newer repository holds up to version 0.92 at

Out of further curiosity:

Which version of the pcre library does it use?
And what version of ghc?
Which version of Data.ByteString?

  Chris Kuklewicz

More information about the Haskell-Cafe mailing list