[Haskell-cafe] Unnecessarily strict implementations

Daniel Fischer daniel.is.fischer at web.de
Mon Sep 6 09:33:03 EDT 2010

On Monday 06 September 2010 10:47:54, Henning Thielemann wrote:
> Daniel Fischer schrieb:
> > On Sunday 05 September 2010 21:52:44, Henning Thielemann wrote:
> >> Daniel Fischer schrieb:
> >>> Yes. Ordinarily, lines in text files aren't longer than a few
> >>> hundred characters, leaking those, who cares?
> >>
> >> I got several space leaks of this kind in the past. They are very
> >> annoying. They are especially annoying if input comes from the
> >> outside world, where people can attack them to crash your program
> >> because of memory exhaustion.
> >
> > That would likely be the case of long lines, wouldn't it?
> > I have trouble imagining a scenario where `lines' holding on to a few
> > hundred characters which could already be released causes a noticeable
> > space leak, let alone memory exhaustion.
> I talked about an _attack_! I provide a program that processes external
> data (say a webserver, for instance one for an ICFP contest) and someone
> feeds it intentionally with megabytes of text without any line ending.

Yes, that's absolutely a problem. I was irritated/confused by the selection 
of text you quoted which was only about the ordinary case of relatively 
short lines.
I didn't originally think about an attack but only about accidental long 
lines, which make it important enough to fix lines' leak. Throw a possible 
attack in, and it's urgent to fix it.

More information about the Haskell-Cafe mailing list