summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnMacFarlane <>2019-03-13 17:58:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-03-13 17:58:00 (GMT)
commit8c04e74eda80b8d3d71f06ef040f5c9b2f0a0265 (patch)
treee6924b9832e056cdd3f39f6041525c6d8ee13e46
parent9d91fec2db7572f7bf86791a48da080ba9697de7 (diff)
version 0.5.6.30.5.6.3
-rw-r--r--CMark.hsc4
-rw-r--r--changelog22
-rw-r--r--cmark.cabal4
3 files changed, 20 insertions, 10 deletions
diff --git a/CMark.hsc b/CMark.hsc
index 27c7bc0..5db7167 100644
--- a/CMark.hsc
+++ b/CMark.hsc
@@ -38,7 +38,7 @@ import Data.Maybe (fromMaybe)
import GHC.Generics (Generic)
import Data.Data (Data)
import Data.Typeable (Typeable)
-import Data.Text (Text, empty)
+import Data.Text (Text, empty, snoc)
import qualified Data.Text.Foreign as TF
import Data.ByteString.Unsafe (unsafePackMallocCString)
import Data.Text.Encoding (decodeUtf8)
@@ -384,7 +384,7 @@ totext str
| otherwise = TF.peekCStringLen (str, c_strlen str)
withtext :: Text -> (CString -> IO a) -> IO a
-withtext t f = TF.withCStringLen t (f . fst)
+withtext t f = TF.withCStringLen (snoc t '\0') (f . fst)
foreign import ccall "string.h strlen"
c_strlen :: CString -> Int
diff --git a/changelog b/changelog
index 5b39963..310b9d8 100644
--- a/changelog
+++ b/changelog
@@ -1,14 +1,24 @@
+cmark 0.5.6.3 (13 Mar 2019)
+
+ * Use snoc instead of <> to add the null terminator.
+
+cmark 0.5.6.2 (13 Mar 2019)
+
+ * Ensure that withtext adds a null terminator (#14).
+ This fixes a regression due to PR #13, which caused
+ random content to appear in rendered TEXT nodes.
+
cmark 0.5.6.1 (11 Mar 2019)
* Fix CString memory leaks (Anders Kaseorg). The renderer functions return
- a malloc’d string which the caller is expected to free.
+ a malloc’d string which the caller is expected to free.
* Fix use-after-free bugs (Anders Kaseorg). `useAsCString` frees the
- CString after the IO action finishes executing, so passing `return` as that
- action can never be correct. To make sure the CString gets freed at the
- right time, we need a “with”-style abstraction, not just a conversion
- function. While we’re here replace this with `withCStringLen`, which also
- makes fewer copies.
+ CString after the IO action finishes executing, so passing `return` as
+ that action can never be correct. To make sure the CString gets freed
+ at the right time, we need a “with”-style abstraction, not just a
+ conversion function. While we’re here replace this with
+ `withCStringLen`, which also makes fewer copies.
* Show node type on error for unknown node type.
diff --git a/cmark.cabal b/cmark.cabal
index 330a44e..5de0b1c 100644
--- a/cmark.cabal
+++ b/cmark.cabal
@@ -1,5 +1,5 @@
name: cmark
-version: 0.5.6.1
+version: 0.5.6.3
synopsis: Fast, accurate CommonMark (Markdown) parser and renderer
description:
This package provides Haskell bindings for
@@ -42,7 +42,7 @@ extra-source-files: README.md
cbits/entities.inc
bench/sample.md
bench/full-sample.md
-cabal-version: >=1.14
+cabal-version: 1.14
Source-repository head
type: git