Re: Don't pass NULL pointer to strcmp().
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Xing Guo <higuoxing@gmail.com>
Cc: Aleksander Alekseev <aleksander@timescale.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>,
Junwang Zhao <zhjwpku@gmail.com>
Date: 2023-11-02T01:57:18Z
Lists: pgsql-hackers
Attachments
- v3-0001-Don-t-use-strcmp-with-nullable-pointers.patch (text/x-diff) patch v3-0001
I wrote: > Hmm ... if we're doing it ourselves, I suppose we've got to consider > it supported :-(. But I'm still wondering how many seldom-used > code paths didn't get the message. An example here is that this > could lead to GetConfigOptionResetString returning NULL, which > I think is outside its admittedly-vague API spec. After digging around for a bit, I think part of the problem is a lack of a clearly defined spec for what should happen with NULL string GUCs. In the attached v3, I attempted to remedy that by adding a comment in guc_tables.h (which is maybe not the best place but I didn't see a better one). That led me to a couple more changes beyond what you had. It's possible that some of these are unreachable --- for example, given that a NULL could only be the default value, I'm not sure that the fix in write_one_nondefault_variable is a live bug. But we ought to code all this stuff defensively, and most of it already was NULL-safe. regards, tom lane
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Make GetConfigOption/GetConfigOptionResetString return "" for NULL.
- 0bc726d95a30 17.0 landed
-
Be more wary about NULL values for GUC string variables.
- ae33659d4239 15.5 landed
- 82063edd4ac3 16.1 landed
- 7704a1a72e87 17.0 landed
- 6e1cca511348 11.22 landed
- 65810fc6d0f6 12.17 landed
- 47c0f00cf90f 14.10 landed
- 137227c6de6e 13.13 landed
-
doc: Replace reference to ERRCODE_RAISE_EXCEPTION by "raise_exception"
- 4210b55f5985 17.0 cited