guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix hashing of vectors to run in bounded time


From: Ludovic Courtès
Subject: Re: [PATCH] Fix hashing of vectors to run in bounded time
Date: Sat, 11 Jan 2014 17:13:02 +0100
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

Mark H Weaver <address@hidden> 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 <address@hidden>
> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]