Ticket #1 (new defect)

Opened 5 years ago

parse problem with whitespace in comments

Reported by: igloo Owned by: somebody
Priority: major Milestone:
Component: component1 Version:
Keywords: Cc:

Description

Satoshi Nakamura <snak@…> reported:

I've been using mime-string-0.3 to parse mime message and found that when
MIME-Version contains a comment which contains white-space it failed to
parse. I looked into the source code and found that it uses p_NO_WS_CTL
where it should use p_FWS. I think the attached patch solve this problem.
diff -ur mime-string-0.3.orig/Codec/MIME/String/Headers.hs mime-string-0.3/Codec/MIME/String/Headers.hs
--- mime-string-0.3.orig/Codec/MIME/String/Headers.hs   2007-03-29 22:06:31.000000000 +0900
+++ mime-string-0.3/Codec/MIME/String/Headers.hs        2007-12-17 12:44:49.000000000 +0900
@@ -151,8 +151,8 @@
 p_comment :: Parser Char ()
 p_comment = ()
         <$  pChar '('
-        <*  pMany (() <$  pMany p_NO_WS_CTL <*  p_ccontent)
-        <*  pMany p_NO_WS_CTL
+        <*  pMany (() <$  p_FWS <*  p_ccontent)
+        <*  p_FWS
         <*  pChar ')'
 
 -- We might want to keep the result. If we do then we also need to
Note: See TracTickets for help on using tickets.