Fix segfault in pg_restore
От | Oliver Elphick |
---|---|
Тема | Fix segfault in pg_restore |
Дата | |
Msg-id | 1043346530.31735.445.camel@linda.lfix.co.uk обсуждение исходный текст |
Ответы |
Re: Fix segfault in pg_restore
|
Список | pgsql-patches |
In pg_restore, die_horribly() is sometimes called with AH a null pointer. If that happens, there is currently a segfault because the code attempts to dereference an element in the AH structure unconditionally: $ pg_restore -Ft nonexistent pg_restore: [tar archiver] could not open TOC file for input: No such file or directory Segmentation fault This patch makes it dereference the structure only if AH is set. Index: src/bin/pg_dump/pg_backup_archiver.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/bin/pg_dump/pg_backup_archiver.c,v retrieving revision 1.65 diff -u -r1.65 pg_backup_archiver.c --- src/bin/pg_dump/pg_backup_archiver.c 2003/01/13 04:28:55 1.65 +++ src/bin/pg_dump/pg_backup_archiver.c 2003/01/23 13:39:16 @@ -1379,14 +1379,15 @@ _die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_list ap) { _write_msg(modulename, fmt, ap); - if (AH->public.verbose) - write_msg(NULL, "*** aborted because of error\n"); - if (AH) + if (AH) { + if (AH->public.verbose) + write_msg(NULL, "*** aborted because of error\n"); if (AH->connection) PQfinish(AH->connection); - if (AH->blobConnection) - PQfinish(AH->blobConnection); + if (AH->blobConnection) + PQfinish(AH->blobConnection); + } exit(1); } -- Oliver Elphick <olly@lfix.co.uk> LFIX Limited
В списке pgsql-patches по дате отправления: