patch applied (packages/HaXml): Bugfix in DtdToHaskell: avoid stack
overflow.
Malcolm Wallace
Malcolm.Wallace at cs.york.ac.uk
Wed Jan 13 10:07:43 EST 2010
Wed Jan 13 06:48:31 PST 2010 Malcolm.Wallace at cs.york.ac.uk
* Bugfix in DtdToHaskell: avoid stack overflow.
Ignore-this: 19a01a75a21fe89a6ad987cce26608a1
As reported by Bertram Felgenhauer, the following DTD
<!ELEMENT dummy EMPTY>
<!ELEMENT broken (#PCDATA | dummy)* >
when passed through DtdToHaskell, generated a parser that crashes on
readXml "<broken>abc</broken>" :: Either String Broken
instead of giving the correct answer
Just (Broken [Broken_Str "abc"])
The fix is to be more careful about generating the parsing expression
(text `onFail` return "")
It is wrong to return the empty string inside a 'many' combinator,
because it simply loops forever. But it is essential to return the empty
string if there is no enclosing zero-or-more combinator.
M ./src/Text/XML/HaXml/DtdToHaskell/Convert.hs -1 +3
M ./src/Text/XML/HaXml/DtdToHaskell/Instance.hs -22 +24
M ./src/Text/XML/HaXml/DtdToHaskell/TypeDef.hs -1 +4
View patch online:
http://darcs.haskell.org/packages/HaXml/_darcs/patches/20100113144831-6871e-44d4e134ef827a2f12cf182162157c605edc3351.gz
More information about the Cvs-libraries
mailing list