Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f0BbS-0003rs-Pa for pgsql-committers@arkaria.postgresql.org; Sun, 25 Mar 2018 19:46:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f0BbR-0007n8-5y for pgsql-committers@arkaria.postgresql.org; Sun, 25 Mar 2018 19:46:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f0BbQ-0007mz-U0 for pgsql-committers@lists.postgresql.org; Sun, 25 Mar 2018 19:46:53 +0000 Received: from mail.thelabyrinth.net ([45.56.70.56]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f0BbO-0000ZT-Bm for pgsql-committers@lists.postgresql.org; Sun, 25 Mar 2018 19:46:51 +0000 Received: from Davids-iMac.local (unknown [173.169.74.224]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id 80E015466C; Sun, 25 Mar 2018 19:46:49 +0000 (UTC) Subject: Re: pgsql: Exclude unlogged tables from base backups To: Tom Lane Cc: Teodor Sigaev , pgsql-committers@lists.postgresql.org References: <14453.1522001792@sss.pgh.pa.us> <8d57c3ba-d44b-a8eb-7a91-c0b6156240fd@pgmasters.net> <3587.1522005723@sss.pgh.pa.us> From: David Steele Message-ID: Date: Sun, 25 Mar 2018 15:46:48 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <3587.1522005723@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/25/18 3:22 PM, Tom Lane wrote: > David Steele writes: >> On 3/25/18 2:16 PM, Tom Lane wrote: >>> Buildfarm member skink (valgrind) has reported this during its last couple >>> of runs: > >> I think skink is using large values for rel oids and that has exposed a >> bug. The strncpy doesn't zero terminate the string if the oid has the >> max number of characters. At least, I was able to reproduce under those >> circumstances. > > Actually, that code didn't guarantee zero termination under *any* > circumstances; it only happened to work if the stack contained > zeroes to start with. Interesting. strncpy() says it will pad the destination with NULLs when src is less than the size provided. Perhaps some compilers don't honor that? >> The attached should fix it. > > Found this in my inbox right after pushing a fix. I did it slightly > differently, emulating the later rather than earlier calls in reinit.c. > The earlier ones memset the whole target field because they're concerned > about being able to hash it, but we don't need that here, just zero > termination. Yeah, that's the way I would normally do it, but when I searched reinit.c the first few hits did memset() so I went with that. Thanks for taking care of it. -- -David david@pgmasters.net