From 2f639ffe09dd24d8648363b567de2d7caa39db99 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 9 Oct 2014 21:38:11 -0700 Subject: Fix use-after-close lazy IO bug Make `getPrologue` force `parseParas dflags str` before returning. Without this, it will attempt to read from the file after it is closed, with unspecified and generally bad results. Signed-off-by: David Feuer Signed-off-by: Edward Z. Yang --- src/Haddock.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Haddock.hs') diff --git a/src/Haddock.hs b/src/Haddock.hs index 980926cd..c0a6714b 100644 --- a/src/Haddock.hs +++ b/src/Haddock.hs @@ -451,7 +451,7 @@ getPrologue dflags flags = [filename] -> withFile filename ReadMode $ \h -> do hSetEncoding h utf8 str <- hGetContents h - return . Just $ parseParas dflags str + return . Just $! parseParas dflags str _ -> throwE "multiple -p/--prologue options" -- cgit v1.2.3