Thread
Commits
-
Make object address handling more robust
- 5721b9b3ceaa 12.0 landed
- 728ac262d18e 11.3 landed
- ddad002dea73 10.8 landed
- 545928bbbf9c 9.5.17 landed
- e4542ca9610c 9.6.13 landed
-
crash in pg_identify_object_as_address
Alvaro Herrera <alvherre@2ndquadrant.com> — 2019-02-18T20:27:43Z
Hello I just came across a crash while debugging some corrupted system catalogs; pg_identify_object_as_address fails to cope with some NULL input, causing a crash. Attached patch fixes it. Naturally, the output array will contain NULL members in the output, but that's better than crashing ... (The first hunk is purely speculative; I haven't seen anything that requires that. The actual fix is in the other hunks. But seems better to be defensive.) The crash can be reproduced thusly create function f() returns int language plpgsql as $$ begin return 1; end; $$; update pg_proc set pronamespace = 9999 where proname = 'f' returning oid \gset select * from pg_identify_object_as_address('pg_proc'::regclass, :oid, 0); After the patch, the last line returns: type | object_names | object_args ----------+--------------+------------- function | {NULL,f} | {} where the NULL obviously corresponds to the bogus pg_namespace OID being referenced. The patch is on 9.6. I checked 10 and it applies fine there. My intention is to apply to all branches since 9.5. -- Álvaro Herrera PostgreSQL Expert, https://www.2ndQuadrant.com/ -
Re: crash in pg_identify_object_as_address
Tom Lane <tgl@sss.pgh.pa.us> — 2019-02-18T22:13:27Z
Alvaro Herrera <alvherre@2ndquadrant.com> writes: > I just came across a crash while debugging some corrupted system > catalogs; pg_identify_object_as_address fails to cope with some NULL > input, causing a crash. Attached patch fixes it. Naturally, the output > array will contain NULL members in the output, but that's better than > crashing ... Hm, does this overlap with Paquier's much-delayed patch in https://commitfest.postgresql.org/22/1947/ ? regards, tom lane
-
Re: crash in pg_identify_object_as_address
Michael Paquier <michael@paquier.xyz> — 2019-02-19T02:21:38Z
On Mon, Feb 18, 2019 at 05:13:27PM -0500, Tom Lane wrote: > Hm, does this overlap with Paquier's much-delayed patch in > https://commitfest.postgresql.org/22/1947/ It partially overlaps, still my patch set would crash as well in that case. Treating object_names the same way as object_args sounds good to me, as well as making strlist_to_textarray smarter to treat NULL inputs. -- Michael
-
Re: crash in pg_identify_object_as_address
Alvaro Herrera <alvherre@2ndquadrant.com> — 2019-02-20T14:27:23Z
Pushed, thanks. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services