tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Kristaps Dzonsons <kristaps@bsd.lv>
To: tech@mdocml.bsd.lv
Subject: Re: fix two crashes in mandocdb
Date: Sun, 13 Nov 2011 01:12:32 +0100	[thread overview]
Message-ID: <4EBF0B70.8040500@bsd.lv> (raw)
In-Reply-To: <20111113000929.GD16229@iris.usta.de>

On 13/11/2011 01:09, Ingo Schwarze wrote:
> Hi,
>
> here are two easy, but important bugfixes for mandocdb(8).
>
> Chunk 1 is required such that mandocdb doesn't die on extremely
> long files.  In my /usr/share/man tree, i have a few very large
> files - not real manuals, but they get in the way.
>
> The man parser produces several tens of thousands of text nodes
> from these files.  When mandocdb.c attempts to parse them, it
> abuses recursion to walk a linear list, resulting in O(N)
> stack size requirements.  Stacks with several tens of thousands
> of frames don't work well, the program consistently segfaulted;
> overflowing thew stack, i guess.
>
> With the for loop, time requirements are still O(N), but at
> least we get constant stack size.  I guess we should scour
> the tree for similar bugs.  This might as well crash massively
> oversized man(7) manuals during normal formatting.
>
>
> Chunk 2 is required to avoid running out of file descriptors
> when walking large directory trees.  Otherwise, mandocdb keeps
> crashing on me because it hits the system resource limit on
> open file descriptors.
>
>
> Using this, i can now run
>
>    # mandocdb /usr/share/man
>
> on my main development machine.
>
> OK?

Ingo, great find!  Please check this in.

Thanks again,

Kristaps

--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

      reply	other threads:[~2011-11-13  0:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-13  0:09 Ingo Schwarze
2011-11-13  0:12 ` Kristaps Dzonsons [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EBF0B70.8040500@bsd.lv \
    --to=kristaps@bsd.lv \
    --cc=tech@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).