unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: Re: [PATCH] Fix hashing of vectors to run in bounded time
Date: Sat, 11 Jan 2014 17:13:02 +0100	[thread overview]
Message-ID: <878uum4hv5.fsf@gnu.org> (raw)
In-Reply-To: 87vbxqv8lt.fsf@netris.org

Mark H Weaver <mhw@netris.org> skribis:

> The 'equal?' hash function in Guile 2.0 uses unbound amounts of runtime
> in many cases involving nested vectors, and can go into an infinite loop
> for cyclic data structures involving vectors.  For example, it will
> always do a complete traversal of a nested tree of vectors of length 5
> or less.

Good catch!

> From 0f1debcb9ac9f350c6bab8fea91e4c7dca0fdd68 Mon Sep 17 00:00:00 2001
> From: Mark H Weaver <mhw@netris.org>
> Date: Sat, 11 Jan 2014 10:18:40 -0500
> Subject: [PATCH] Fix hashing of vectors to run in bounded time.
>
> * libguile/hash.c (scm_hasher): In vector case, do nothing if d is 0.
>   Make sure to recurse with a reduced d.  Move the loop out of the 'if'.

Looks good to me.

Thanks,
Ludo’.




      reply	other threads:[~2014-01-11 16:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-11 15:30 [PATCH] Fix hashing of vectors to run in bounded time Mark H Weaver
2014-01-11 16:13 ` Ludovic Courtès [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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=878uum4hv5.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).