From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24821 invoked by alias); 3 Mar 2011 22:59:25 -0000 Received: (qmail 24800 invoked by uid 22791); 3 Mar 2011 22:59:24 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_XF,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Mar 2011 22:59:22 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p23Mx9vG009839 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 3 Mar 2011 17:59:09 -0500 Received: from greed.delorie.com (ovpn-113-35.phx2.redhat.com [10.3.113.35]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p23Mx8ab029636 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 3 Mar 2011 17:59:09 -0500 Received: from greed.delorie.com (localhost.localdomain [127.0.0.1]) by greed.delorie.com (8.14.4/8.14.4) with ESMTP id p23Mx7rb014569; Thu, 3 Mar 2011 17:59:07 -0500 Received: (from dj@localhost) by greed.delorie.com (8.14.4/8.14.4/Submit) id p23Mx6R0014467; Thu, 3 Mar 2011 17:59:06 -0500 Date: Thu, 03 Mar 2011 22:59:00 -0000 Message-Id: <201103032259.p23Mx6R0014467@greed.delorie.com> From: DJ Delorie To: Michael Snyder CC: gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org In-reply-to: <4D70158A.5080209@vmware.com> (message from Michael Snyder on Thu, 03 Mar 2011 14:26:18 -0800) Subject: Re: [RFA] libiberty/hashtab.c, higher_prime_index: avoid array overrun References: <4D701056.1080208@vmware.com> <201103032211.p23MB9Ed003261@greed.delorie.com> <4D70158A.5080209@vmware.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00230.txt.bz2 Bizzare, the problem isn't the hash loop, it's the error handler at the end! It never uses [30] for the main loop, only if you give it a number between 0xfffffffb and 0xffffffff - and in the case where it would use [30], it's supposed to abort anyway. I couldn't figure out why your patch worked until I realized that the main loop still fails! It works because the error handler just doesn't abort, returning the last array entry, which happens to be the right one. I think a suitable comment explaining what's actually going on, and why it still works, is warranted... but your patch is OK with me otherwise :-)