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 1m3BLG-0006Uo-Dq for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jul 2021 05:52:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m3BLF-0004QB-Cw for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jul 2021 05:52:25 +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 1m3BLF-0004Q3-29 for pgsql-hackers@lists.postgresql.org; Tue, 13 Jul 2021 05:52:25 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m3BLC-0002J1-S9 for pgsql-hackers@lists.postgresql.org; Tue, 13 Jul 2021 05:52:24 +0000 Received: by mail-wr1-x431.google.com with SMTP id d2so28882323wrn.0 for ; Mon, 12 Jul 2021 22:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=PJ6OHXdKzo1pvSg+9Lh7tNYxcMw/SA4I/ESnw2OShqw=; b=kXYI0L5qCHIc/lAeERIKmlHT7JQ8uBYGMm5tnsVSOeSkHQt8jkleAk46JZ28l8jIf/ 4j0bSzalUiG76+2IvKxvR+YeyxDavScXZ9TYo5PDZ/gDy9E+MAsbEZ0rDkHpuaq1UwnG CMi/DwQC7ocBbB3b1qKFgP9PpUH9a/KJyY8otDrEXd0f2KNZIWq4WMFcjWtXPLDAaeb9 xGjiRPw/HQ7LJMQG2GKmjYTBv0ghrlZ8N+1/n9h6azDd7jlj+YFJMDR238STX6nDt51M nHBLuDbJ0UiBebNsUfGdf6sAv+MKyxWLABdn5y1me2fLYYhA9wtSFHIc6GG1do7wgQCk kMJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=PJ6OHXdKzo1pvSg+9Lh7tNYxcMw/SA4I/ESnw2OShqw=; b=CU/aIidH5y//kI9A/m0WXwGq4yE/xtMmhH3QUqUlrzLJ8mygCOauRQDVuN3nICPoed v0hoiLfZ3kNOkpiwsx+jw9pPh7H6XhinyAC/wD3EZHCjfEKGG38zOuc35/tJffJ1T6yo D+YBNb6MkEZ89Eh1xwUFQcqv32hsSEbOx2qVEVL4LdBxAe4gyeB3SdD86BxmsHKET8nK B3fmPdeOnEmBIlxumbdpcKNUCKFgFe+16hhxJ5zWCsEAcfJJOHkR+pQjeYMmCkGYwKgw OG6qxCQNdSG2GHMNmU5t23aC0EP0DS6qfnAusCOSYJYovAZ/EndIQADWCddrxAosLnxb ASww== X-Gm-Message-State: AOAM530l3+guj1o2raxUp0LM66t4q2EHahiLjVjsVUPpaTkdorDOII17 a29GiwDnmOMqRao2hO2UB+TR0o+qpM2aHQ== X-Google-Smtp-Source: ABdhPJzzbMKySUyz9kh6vrY4E+hIw83XWz/GPpQGc9lUGm3svQr5z/YfMzBT2ecB0NhxMV/bAwSvRw== X-Received: by 2002:a5d:530c:: with SMTP id e12mr3285117wrv.130.1626155541536; Mon, 12 Jul 2021 22:52:21 -0700 (PDT) Received: from localhost.localdomain (217-149-171-152.nat.highway.telekom.at. [217.149.171.152]) by smtp.gmail.com with ESMTPSA id o11sm13916053wmq.1.2021.07.12.22.52.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 22:52:21 -0700 (PDT) Message-ID: Subject: Re: printf %s with NULL pointer (was Re: BUG #17098: Assert failed on composing an error message when adding a type to an extension being dropped) From: Laurenz Albe To: Tom Lane , pgsql-hackers@lists.postgresql.org Date: Tue, 13 Jul 2021 07:52:20 +0200 In-Reply-To: <2984422.1626110456@sss.pgh.pa.us> References: <17098-b960f3616c861f83@postgresql.org> <2468663.1626017338@sss.pgh.pa.us> <2984422.1626110456@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2021-07-12 at 13:20 -0400, Tom Lane wrote: > > However, that root issue is converted from a relatively minor bug into > > a server crash because snprintf.c treats a NULL pointer passed to %s > > as a crash-worthy error. I have advocated for that behavior in the > > past, but I'm starting to wonder if it wouldn't be wiser to change > > over to the glibc-ish behavior of printing "(null)" or the like. > > So my feeling about this is that switching snprintf.c's behavior > would produce some net gain in robustness for v12 and up, while > not making things any worse for the older branches. I still hold > to the opinion that we've already flushed out all the cases of > passing NULL that we're likely to find via ordinary testing. New cases could be introduced in the future and might remain undetected. What about adding an Assert that gags on NULLs, but still printing them as "(null)"? That would help find such problems in a debug build. Yours, Laurenz Albe