Mark H Weaver <[email protected]> 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 <[email protected]>
> 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