On Sat, Nov 19, 2016 at 9:31 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: > Andreas Seltenreich <seltenre...@gmx.de> writes: >> sqlsmith just made a GUC that tricks the serialization code into >> dereferencing a nullpointer. Here's a recipe: > > Thanks for the report! Looks like the serialization code has overlooked > the fact that string-valued GUCs can be NULL. Surprising we didn't > find that before ...
I was half-way through it when you sent your email. It seems to me that we need to take care only of the case for PGC_STRING, per the attached. -- Michael
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 3c695c1..3316092 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -8959,7 +8959,10 @@ estimate_variable_size(struct config_generic * gconf) { struct config_string *conf = (struct config_string *) gconf; - valsize = strlen(*conf->variable); + if (*conf->variable && **conf->variable) + valsize = strlen(*conf->variable); + else + valsize = 0; } break;
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers