Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sBLUm-00FzPk-0L for pgsql-committers@arkaria.postgresql.org; Sun, 26 May 2024 21:33:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sBLUl-004qqv-Mg for pgsql-committers@arkaria.postgresql.org; Sun, 26 May 2024 21:33:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sBLUl-004qqn-A0 for pgsql-committers@lists.postgresql.org; Sun, 26 May 2024 21:33:35 +0000 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sBLUh-000ugq-Ih for pgsql-committers@lists.postgresql.org; Sun, 26 May 2024 21:33:34 +0000 Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3c9c36db8eeso5038936b6e.0 for ; Sun, 26 May 2024 14:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1716759209; x=1717364009; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:autocrypt:cc:content-language :from:references:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=OKIqa9CimWoOzU6aIKlntLZ5ef0gSYKupi4vj2/X9Qk=; b=w8SoaeBqFe0VjRlAfh4K8RUMTspmPQC/cqifLGrxj+3E435bwDXl18TLAPN5N5ebfg GkpNSUO1UhIOvTlxaliDVoP7WbX5iZkW8cNX9YFReCPDzsEKuNIAtSqZcuijHasDBx7w e9cn3p430q39Snnsk43TMeSqQhCZzStArU0P5lok3mTA4DAYRtjKXkT3e178YHKDsvFq lTuWra0DzaJ1zzd8CiTHGIwzwLP7NlZhPe9BBcmnlNzOa7GaLHEI6v0S6el0LM5dwLfY XKvMo6NL+DB7Cp/i+0B/zt3Oq9HvyhfFAT9TxvlcbImdIObV/VZRQ7kKdezn0PAlprOq eYZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716759209; x=1717364009; h=content-transfer-encoding:in-reply-to:autocrypt:cc:content-language :from:references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OKIqa9CimWoOzU6aIKlntLZ5ef0gSYKupi4vj2/X9Qk=; b=NPkueln6X4mdCfuAznGqpcElU4Gg1lPzgh+J6doRxRJAHmkEmWuq36m64gM4TstLEO 3EizltBJ+6RAQJ32Q+Z7aIJ7NtM1gLlNiLYBZp03CZQB1eeUi4X3k5GYitF7u1TFqg7U 08WEYuiZr7P+gzWwquZ8M1oVZ8n2GrrUD/11FW15ywe34fCCbBfoOlqlesPaC+kNQVtl 4v7nRmLGFe0LI4kSQ7nT6VF+R0YIgsh30lKC4RTIs7JIGmItMYxXKEb3mvW84Ye/rvbp td+PTIDHb3j4Mq2qwtO/tKlVCshVkUHQ1Ao7fATShviMTVueKwxDyd0HXnb58uOF8ZSw 5jZg== X-Forwarded-Encrypted: i=1; AJvYcCXn+yUZAsUh1rmWtkwGyZZxhSkbbmK0Rs4k56OgmaqWaWKfG8qIvuFrRmLRBXjuY/QlJOSrgca0Umgml5VjOo0vDlWFvVfK0AzYyUxu5kMFREzuztf/ X-Gm-Message-State: AOJu0YzTI2qt/cl9jzS109TeymJ6PAxYkwSJ+ME5c/nd83NnUrgAnfvE ZCB9I1FU+FXg3mc44bVgd81ayvCiDUF+8S9sNJF9bD1PeQm7NmhXGBOPSBz52CjIQKw+Af0x0un k X-Google-Smtp-Source: AGHT+IHAWT9jiftUCCswy+nWygpXKa5L1WcXUxSdqGV6Tq8CH0tyOH94gpK3Bg8kZizQuWvGjiNYvw== X-Received: by 2002:a05:6808:1312:b0:3c9:92f3:d528 with SMTP id 5614622812f47-3d1a538ea86mr10351323b6e.12.1716759209025; Sun, 26 May 2024 14:33:29 -0700 (PDT) Received: from ?IPV6:2605:a601:9180:9800::2bb? ([2605:a601:9180:9800::2bb]) by smtp.googlemail.com with ESMTPSA id 6a1803df08f44-6ac070c2eeasm29189146d6.19.2024.05.26.14.33.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 May 2024 14:33:28 -0700 (PDT) Message-ID: <77a35cd9-5a68-47db-8ded-895d262f5d70@dunslane.net> Date: Sun, 26 May 2024 17:33:27 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pgsql: Fix potential NULL pointer dereference in getIdentitySequence() To: Michael Paquier , pgsql-committers@lists.postgresql.org References: From: Andrew Dunstan Content-Language: en-US Cc: Ashutosh Bapat Autocrypt: addr=andrew@dunslane.net; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAHNJEFuZHJldyBEdW5zdGFuIDxhbmRyZXdAZHVuc2xhbmUubmV0PsLAmwQTAQgARQIbAwIX gAIZAQULCQgHAgMiAgEGFQoJCAsCBBYCAwECHgcW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HRzC1jgQNidyd6tKqcsVJs0dzF0oKTmFFmUAqTdJO12LBuNA1rlqrR3EtpYk8B/wtS 5dIMD7Q8hwQpL+4C6GNpb6ZKnPkLi47pDOLhz2qBrqN+rqUEsT3YnExYpzj5yOBi+FlmV1Hw 49QYe1sn2ZPs In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-05-26 Su 07:58, Michael Paquier wrote: > Fix potential NULL pointer dereference in getIdentitySequence() > > The function invokes SearchSysCacheAttNum() and SearchSysCacheAttName(). > They may respectively return 0 for the attribute number or NULL for > the attribute name if the attribute does not exist, without any kind of > error handling. The common practice is to check that the data retrieved > from the syscache is valid. There is no risk of NULL pointer > dereferences currently, but let's stick to the practice of making sure > that this data is always valid, to catch future inconsistency mistakes. > The code is switched to use get_attnum() and get_attname(), and adds > some error handling. > > Oversight in 509199587df7. > > Reported-by: Ranier Vilela > Author: Ashutosh Bapat > Discussion: https://postgr.es/m/CAEudQAqh_RZqoFcYKso5d9VhF-Vd64_ZodfQ_2zSusszkEmyRg@mail.gmail.com > This appears to have upset a number of buildfarm members cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com