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 1stBf0-00EDMH-8w for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Sep 2024 19:57:22 +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 1stBez-00DFON-Ki for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Sep 2024 19:57:21 +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 1st6sZ-0097iH-Tg for pgsql-hackers@lists.postgresql.org; Tue, 24 Sep 2024 14:51:03 +0000 Received: from air.basealt.ru ([194.107.17.39]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1st6sW-000rID-47 for pgsql-hackers@lists.postgresql.org; Tue, 24 Sep 2024 14:51:03 +0000 Received: by air.basealt.ru (Postfix, from userid 490) id 40A662F2022C; Tue, 24 Sep 2024 14:51:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on air.basealt.ru X-Spam-Level: X-Spam-Status: No, score=-2.9 required=7.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 Received: from [10.4.129.65] (unknown [193.43.10.250]) by air.basealt.ru (Postfix) with ESMTPSA id D39922F20226; Tue, 24 Sep 2024 14:50:59 +0000 (UTC) Message-ID: Date: Tue, 24 Sep 2024 17:50:59 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Possible null pointer dereference in afterTriggerAddEvent() From: Alexander Kuznetsov To: Alvaro Herrera Cc: pgsql-hackers@lists.postgresql.org, nickel@altlinux.org, egori@altlinux.org Reply-To: kuznetsovam@altlinux.org, kuznetsovam@altlinux.org References: <202407251707.tkkrcs7c4eso@alvherre.pgsql> <8ddb8e6a-e899-4218-870f-8b25da3a9f3f@altlinux.org> Content-Language: en-US In-Reply-To: <8ddb8e6a-e899-4218-870f-8b25da3a9f3f@altlinux.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, is there anything else we can help with or discuss in order to apply this fix? 26.07.2024 12:16, Alexander Kuznetsov пишет: > 25.07.2024 20:07, Alvaro Herrera wrote: >> Maybe for sanity (and perhaps for Svace compliance) we could do it the >> other way around, i.e. by testing events->tail for nullness instead of >> events->head, then add the assertion: >> >>         if (events->tail == NULL) >>         { >>             Assert(events->head == NULL); >>             events->head = chunk; >>         } >>         else >>             events->tail->next = chunk; >> >> This way, it's not wholly redundant. > Thanks for your response! > I agree with the proposed changes and have updated the patch accordingly. Version 2 is attached. >> That said, I'm not sure we actually *need* to change this. > I understand and partly agree. But it appears that with these changes, the dereference of a null pointer is impossible even in builds where assertions are disabled. Previously, this issue could theoretically occur. Consequently, these changes slightly enhance overall security. > -- Best regards, Alexander Kuznetsov