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 1n6bNS-0004XK-Re for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Jan 2022 16:49:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n6bNR-0005HC-9l for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Jan 2022 16:49:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n6bNQ-0005H3-KQ for pgsql-hackers@lists.postgresql.org; Sun, 09 Jan 2022 16:49:04 +0000 Received: from mail-qt1-x831.google.com ([2607:f8b0:4864:20::831]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n6bNL-0003o4-AD for pgsql-hackers@postgresql.org; Sun, 09 Jan 2022 16:49:03 +0000 Received: by mail-qt1-x831.google.com with SMTP id y17so11880687qtx.9 for ; Sun, 09 Jan 2022 08:48:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=EzoV1eSJQ/gkOX4AuLQxfF/EwbYqtUzhPYLBE0orE7o=; b=GSNuX1+5X8j0ZoI6Zw6od9rn45JANZtwia4UqvHajd8t7Mr3+Hh9HRgWuTbt0Csf4K FYbwz1XTU7htawa/y+SemI8eMyc38eKGquXXzcxZ+viwPetjXVHq28NY8gnMLbi4t+7u KVwg0qQyJTlGgXZc18uYp1S67BeswKFQOmbhU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=EzoV1eSJQ/gkOX4AuLQxfF/EwbYqtUzhPYLBE0orE7o=; b=E6nJjj0aCg2xc7QXF7b40QRvDoWtEc6Q2VTClnE0AC3oqjaolyabZDmOzJAEdL5DRN jGSIoRBB6BQVSKOrXPvVwXF1DC39upK8yf7ffBm6RG3nJY8xJmDI2pxpqNZQwqpu5OSj aQzm0L8zx2aiPNysOGfJoepI6Q1wcmyLnyKyeMhCQiaWGXHn9T37+5nyUt9ojAHzbk5b wsI4Sv49JaHCBZhPLe+nK3x783Ir8qgTAFmhoOHCAr+ot5XIeg/PUDONzjMbah3wKRhJ sGwdomE3zmS6hVwD00Bo5fw1ACybPb0Dtj1mx8Yabo9IsKbKnbLpDXytf17OxCEO/RWN T+7A== X-Gm-Message-State: AOAM532yqurn/SafTIlqqn2gyLo0JpRXh/xylHoWNsM5c8CoKV2dkDu1 WOYKB0J291mrKXfVx0GSlxw2rxthgUkpV/Q7 X-Google-Smtp-Source: ABdhPJzjFJ+vKPVjvq5Wt9W1aqC8ML7l5lj9Aa32vPx5h9MUpNUA8WYeGUnpXRXafOnE7ccMnfWaaQ== X-Received: by 2002:ac8:5795:: with SMTP id v21mr11147029qta.551.1641746938222; Sun, 09 Jan 2022 08:48:58 -0800 (PST) Received: from rfd.leadboat.com ([2600:1702:a20:5750::2e]) by smtp.gmail.com with ESMTPSA id r23sm2861592qkk.24.2022.01.09.08.48.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Jan 2022 08:48:57 -0800 (PST) Date: Sun, 9 Jan 2022 08:48:54 -0800 From: Noah Misch To: Tom Lane , Zhihong Yu Cc: PostgreSQL-development Subject: Re: null iv parameter passed to combo_init() Message-ID: <20220109164854.GA309234@rfd.leadboat.com> References: <20220109015202.GB283924@rfd.leadboat.com> <20220109031100.GC283924@rfd.leadboat.com> <1643134.1641713553@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Jan 09, 2022 at 04:37:32AM -0800, Zhihong Yu wrote: > On Sat, Jan 8, 2022 at 11:32 PM Tom Lane wrote: > > Noah Misch writes: > > > On further thought, I would write it this way: > > > > > - else > > > + else if (ivlen != 0) > > > memcpy(ivbuf, iv, ivlen); > > > > FWIW, I liked the "ivlen > 0" formulation better. They should be > > equivalent, because ivlen is unsigned, but it just seems like "> 0" > > is more natural. If I were considering the one code site in isolation, I'd pick "ivlen > 0". But of the four sites identified so far, three have signed length variables. Since we're likely to get more examples of this pattern, some signed and some unsigned, I'd rather use a style that does the optimal thing whether or not the variable is signed. What do you think? > Patch v4 is attached. Does this pass the test procedure shown upthread?