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 1u2wTB-0086B0-Qq for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Apr 2025 18:17:46 +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 1u2wT9-00Fn6t-2Q for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Apr 2025 18:17:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u2wT7-00Fn4b-UE for pgsql-bugs@lists.postgresql.org; Thu, 10 Apr 2025 18:17:42 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u2wT6-0046Jg-0E for pgsql-bugs@lists.postgresql.org; Thu, 10 Apr 2025 18:17:41 +0000 Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9F13E254009B; Thu, 10 Apr 2025 14:17:38 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-07.internal (MEProxy); Thu, 10 Apr 2025 14:17:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1744309058; x=1744395458; bh=7HVhHOdJu0 m1q8mZy4r2TuAfEDXeKiZKnw8WrKx7VDU=; b=G5Jyq4v0LWzwcmLckE/AHrUQd7 Ec0UiTWCQytBgQWB8zy6umz83O7jPBraL2shodmccYCKxmjckjpRckO5J9Zpdn42 cK1sCIq2H2l9OocpMrQlXBosTss8GWCsw0DCXY7OQesmthaoLEBair2YGhMYRq61 rUumygVF8M1gks1eZJ5FEqFWsCBfikR/7TykCN6bYPBuDldko0Hs2g9Ej6C1284j uXf5o1vgsq+66XObGqU0zMcGNGa/8mpum+6tiHFfV0anO95x7pX3bK+crjHllpBd a6kIcYLZRVl5YtJ+f76MudB0whCL2veHlEqvy25YbqyYwjd67M+rNhHLxJqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1744309058; x=1744395458; bh=7HVhHOdJu0m1q8mZy4r2TuAfEDXeKiZKnw8 WrKx7VDU=; b=L+Rr9OWQ1rUVBQjNIj3s1/s5HgwvxP1PmVoHzj+YO06xEUoOEcV fUOMPJf0QfYsmETD73e4AsBziGJ4PdFMhzo8jg8DthczjLKCNdZ+AwxIlowfyo8/ hCKw/b/DPrWPmdsmX4RA7TgVvJ1jHOagSDeJt63fLNcC7q8sOPMzNq3BZ2AZPldG Hhs9OmKw1fnJ0QSFj9ZmnmJfvO1ICNOX81ha0tLKtZY9Kth2VzRe4OYbOi4mx4kG vZ5TAxKbCtH7Vws7O5pkKceY/SdwGlqkiJoJd/3OPFKvd29UnJfQnD+oHEnebcQO DZEX+2ylyrQI8VBUBDNstpJ3PXllx1MncEw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvtdelieduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefogg ffhffvkfgjfhfutgesrgdtreerredttdenucfhrhhomhepfdfguhhlvghrucfvrghvvghi rhgrfdcuoegvuhhlvghrsegvuhhlvghrthhordgtohhmqeenucggtffrrghtthgvrhhnpe fhtdduleeufeeltedutddukeekfeeugedvgfejteeggfffteeiffdugffgueffteenucff ohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepvghulhgvrhesvghulhgvrhhtohdrtgho mhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepph hgshhqlhdqsghughhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphht thhopegurghnqdgvlhhisehmrghilhdrrhhu X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id B4D0978006B; Thu, 10 Apr 2025 14:17:37 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: Tda75b3349e58bef6 Date: Thu, 10 Apr 2025 15:17:17 -0300 From: "Euler Taveira" To: =?UTF-8?Q?=D0=94=D0=B0=D0=BD=D0=B8=D0=B8=D0=BB_=D0=AD=D0=BB=D0=B8=D1=88?= =?UTF-8?Q?=D0=B0=D0=BA=D0=BE=D0=B2?= , pgsql-bugs@lists.postgresql.org Message-Id: In-Reply-To: <18888-31bcf4436ea6a20d@postgresql.org> References: <18888-31bcf4436ea6a20d@postgresql.org> Subject: Re: BUG #18888: /src/interfaces/ecpg/preproc/descriptor.c possible NULL dereference Content-Type: multipart/alternative; boundary=619177c18aa64af7a6eed0e4351a1b75 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --619177c18aa64af7a6eed0e4351a1b75 Content-Type: text/plain Content-Transfer-Encoding: 7bit On Thu, Apr 10, 2025, at 1:39 PM, PG Bug reporting form wrote: > On 203 and 313 lines It seems that a struct data type should not be used in > 'EXEC SQL SET DESCRIPTOR' command, so the code in question should never be > executed and it is not a problem. However there are no actual checks for > corrrectess of the provided data type. It is required to add a check against > wrong data types supplied by the user. Which struct data type? struct variable? Did you read find_variable()? At the end, it has if (p == NULL) mmfatal(PARSE_ERROR, "variable \"%s\" is not declared", name); return p; mmfatal() is marked as noreturn so it is not possible that find_variable() returns NULL. Hence, struct variable *v is always a valid pointer. If you're directly opening bug reports based on a static analyzer output without a previous analysis, don't do that. These SATs generally report lots of false positives. Instead, investigate each report and (if possible) create a reproducible test case demonstrating that it is a real issue. -- Euler Taveira EDB https://www.enterprisedb.com/ --619177c18aa64af7a6eed0e4351a1b75 Content-Type: text/html Content-Transfer-Encoding: quoted-printable
On Thu, Apr 10,= 2025, at 1:39 PM, PG Bug reporting form wrote:
On 203 and 313 lines It seems that a st= ruct data type should not be used in
'EXEC SQL SET DESCRIPTOR'= command, so the code in question should never be
executed and= it is not a problem. However there are no actual checks for
c= orrrectess of the provided data type. It is required to add a check agai= nst
wrong data types supplied by the user.

Which struct data type? struct variable?

Did you read find_variable()? At the end, it has
<= div>
    if (p =3D=3D NULL)
 = ;       mmfatal(PARSE_ERROR, "variable \"%= s\" is not declared", name);

   = return p;

mmfatal() is marked as noreturn so i= t is not possible that find_variable()
returns NULL. Hence, st= ruct variable *v is always a valid pointer.

If = you're directly opening bug reports based on a static analyzer output
without a previous analysis, don't do that. These SATs generally= report lots of
false positives. Instead, investigate each rep= ort and (if possible) create a
reproducible test case demonstr= ating that it is a real issue.

--
Euler Tave= ira
--619177c18aa64af7a6eed0e4351a1b75--