From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Fix hashing of vectors to run in bounded time Date: Sat, 11 Jan 2014 17:13:02 +0100 Message-ID: <878uum4hv5.fsf@gnu.org> References: <87vbxqv8lt.fsf@netris.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1389456803 17782 80.91.229.3 (11 Jan 2014 16:13:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Jan 2014 16:13:23 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jan 11 17:13:30 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W21Bg-0005UO-Bc for guile-devel@m.gmane.org; Sat, 11 Jan 2014 17:13:28 +0100 Original-Received: from localhost ([::1]:34523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W21Bf-0003h2-R4 for guile-devel@m.gmane.org; Sat, 11 Jan 2014 11:13:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W21BX-0003gA-Uz for guile-devel@gnu.org; Sat, 11 Jan 2014 11:13:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W21BR-0003tf-Od for guile-devel@gnu.org; Sat, 11 Jan 2014 11:13:19 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:52717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W21BR-0003tX-I7 for guile-devel@gnu.org; Sat, 11 Jan 2014 11:13:13 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W21BP-0005De-L8 for guile-devel@gnu.org; Sat, 11 Jan 2014 17:13:11 +0100 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Jan 2014 17:13:11 +0100 Original-Received: from ludo by reverse-83.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Jan 2014 17:13:11 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 22 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: reverse-83.fdn.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 22 =?utf-8?Q?Niv=C3=B4se?= an 222 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:TU6uZiUH0D/T8TTKltjMuh9Gqt4= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16800 Archived-At: Mark H Weaver 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 > 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’.