Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDxY6-0005hB-5L for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Sep 2020 22:17:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kDxY4-0000qI-RO for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Sep 2020 22:17:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDxY4-0000qA-KU for pgsql-hackers@lists.postgresql.org; Thu, 03 Sep 2020 22:17:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDxXy-0003Ur-2d for pgsql-hackers@lists.postgresql.org; Thu, 03 Sep 2020 22:17:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 083MHUl4795511; Thu, 3 Sep 2020 18:17:31 -0400 From: Tom Lane To: Alvaro Herrera cc: Pg Hackers Subject: Re: report expected contrecord size In-reply-to: <20200903220034.GA22006@alvherre.pgsql> References: <20200903220034.GA22006@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Thu, 03 Sep 2020 18:00:34 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <795509.1599171450.1@sss.pgh.pa.us> Date: Thu, 03 Sep 2020 18:17:30 -0400 Message-ID: <795510.1599171450@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > Well, the intention there is to cast the first operand (which is uint32) > so that it turns into signed 64-bits; the subtraction then occurs in 64 > bit arithmetic normally. If I let the subtraction occur in 32-bit width > unsigned, the result might overflow 32 bits. Uh ... is it really possible for gotlen to be more than total_len? (I've not looked at the surrounding code here, but that seems weird.) regards, tom lane