[BUGFIX] Fix crash due to sizeof bug in RegisterExtensionExplainOption - Mailing list pgsql-hackers

From Joel Jacobson
Subject [BUGFIX] Fix crash due to sizeof bug in RegisterExtensionExplainOption
Date
Msg-id 2a4bd2f5-2a2f-409f-8ac7-110dd3fad4fc@app.fastmail.com
Whole thread Raw
Responses Re: [BUGFIX] Fix crash due to sizeof bug in RegisterExtensionExplainOption
List pgsql-hackers
Hi hackers,

The allocations in src/backend/commands/explain_state.c
used sizeof(char *) instead of sizeof(ExplainExtensionOption),
which could cause a crash if an extension would register
more than 8 extension EXPLAIN options:

Attached small example extension, test_explain_state.txt,
to demonstrate the bug:

LOAD 'test_explain_state';
LOAD
EXPLAIN (test_explain_opt9) SELECT 1;
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.
connection to server was lost

/Joel

Attachment

pgsql-hackers by date:

Previous
From: Sami Imseih
Date:
Subject: Re: pg_stat_statements: Add gc_count and query_file_size to pgss_info
Next
From: Ants Aasma
Date:
Subject: Re: Hash aggregate collisions cause excessive spilling