Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVLfC-0003th-Vh for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Jul 2017 17:43:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dVLfC-0002ud-II for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Jul 2017 17:43:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dVLfB-0002sd-Qy for pgsql-bugs@postgresql.org; Wed, 12 Jul 2017 17:43:01 +0000 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dVLf9-0002M0-6i for pgsql-bugs@postgresql.org; Wed, 12 Jul 2017 17:43:01 +0000 Received: by mail-lf0-x241.google.com with SMTP id z78so3769303lff.2 for ; Wed, 12 Jul 2017 10:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=5uFuTdRJgeMYnh8PboyRy4ETTwzg7Gy2EZeWu+4OckA=; b=UgwRXVzlj6WjPUISicCTRz8FVnE71rqmPPX0Uhdc0ZY62ihikvQ469RJR7WLVl9o4v 77Km4aVJI/pmdzwnsNmRtZiVWy8de0TfCoeSS5vFPlGHqZs4ulN9rFCpJicnPeFWCqVP WpP8JXpfRwpaX2R+HxdgtM74quXuN46uAQNZIiy3oO7gwiT6CTGGOrXls1x0ks7kQePI g6qOYFeqBOMq7dBN5Bq6MG5jvT0B0vihyxcm9334Df/IjFGg5ADcBlFXCtBRgEKZZhag eCLBNv8gMkAyleuU5kmxjok2ae60868alXPCzEDYAhgvJsILZc9UCjslg0F6XzAQ3oUp ohTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=5uFuTdRJgeMYnh8PboyRy4ETTwzg7Gy2EZeWu+4OckA=; b=M2kVhWmCgWJOZPT8OzKHNcFqppd/d68X2/2ADywosRQfztiq8/PEmIDFnZgK9BEz3f UcVJvlC6ILNWXHDgLaOUVuW42moSRvBb0WI7pdFDduUyYNP57zu/dDusz5rwU+dr+Pjo 9OayaZ8DUxdwkv5HmSaVym8ISMdK68wubdxMc9BxqD+FSY863JUl1Eus8timuWHNHTtM F1R2GcstNWQU6NxRMLq62iXp/q0/wz+gXv7Mr4H4NAEBIce51YtxwDclQZTSyE2l4Ych hsFe7FdINfUATR1+AvZ84CICbxVhcbbeH+5/UqRzao/ayrZfdtRr40cqBI3M6Vq0f6q3 vCcA== X-Gm-Message-State: AIVw110OgwQ5ZIBDtXB1pxE5jaOuzMjZob3thXMTfegLqmqVWrzMHTfr RtV3ciZgKKZtHD3L X-Received: by 10.46.7.17 with SMTP id 17mr2300140ljh.17.1499881378074; Wed, 12 Jul 2017 10:42:58 -0700 (PDT) Received: from [192.168.1.99] (dsl-hkibng32-54fb4e-103.dhcp.inet.fi. [84.251.78.103]) by smtp.gmail.com with ESMTPSA id i68sm675739lfg.30.2017.07.12.10.42.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 10:42:57 -0700 (PDT) Subject: Re: BUG #14722: Segfault in tuplesort_heap_siftup, 32 bit overflow To: Peter Geoghegan References: <20170629161637.1478.93109@wrigleys.postgresql.org> <1499281579.8258.32.camel@cmu.edu> <28906.1499292236@sss.pgh.pa.us> <20170705221414.bgnw73z2mwkjwor7@alap3.anarazel.de> <3de75af4-a49f-36d1-347f-f170693ce6f5@iki.fi> Cc: Andres Freund , Tom Lane , Sergey Koposov , "pgsql-bugs@postgresql.org" From: Heikki Linnakangas Message-ID: <3ab2dc21-8a01-aa00-8967-5cbfe92ae82c@iki.fi> Date: Wed, 12 Jul 2017 20:42:55 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 07/12/2017 08:16 PM, Peter Geoghegan wrote: > On Wed, Jul 12, 2017 at 6:15 AM, Heikki Linnakangas wrote: >> Another option to use "unsigned int", on the assumption that UINT_MAX >= >> INT_MAX * 2 + 1. And to eliminate that assumption, we can use (UINT_MAX - 1) >> / 2 as the maximum size of the memtuples array, rather than INT_MAX. > > FWIW, memtupcount is allowed to go negative. Huh, say what? - Heikki -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs