fix xact.c for bad pointer checking

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема fix xact.c for bad pointer checking
Дата
Msg-id 1091529319.24603.90.camel@jeff
обсуждение исходный текст
Список pgsql-patches
I haven't posted a code patch before, so please be a little patient.

In the 2004-08-02 snapshot, the following sequence causes a crash
(thanks to Christopher Kings-Lynne for finding this bug):

test=# begin;
BEGIN
test=# savepoint "A";
SAVEPOINT
test=# rollback to a;
server closed the connection unexpectedly

--8<--snip--8<--

This seems to have been caused by bad pointer checking in xact.c. I have
attached a patch which fixes that crash. I do not see any side effects,
and it doesn't look like anything needs to additionally be cleaned up,
since that seems to be the same execution path the orginal author
intended for an invalid savepoint name anyway.

Regards,
    Jeff Davis


--- src/backend/access/transam/xact.c.old  2004-08-03 03:18:12.000000000
-0700
+++ src/backend/access/transam/xact.c      2004-08-03 03:19:05.000000000
-0700
@@ -2529,7 +2529,7 @@
                target = target->parent;

                /* we don't cross savepoint level boundaries */
-               if (target->savepointLevel != s->savepointLevel)
+               if (PointerIsValid(target) && (target->savepointLevel !=
s->savepointLevel))
                        ereport(ERROR,

(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
                                         errmsg("no such savepoint")));



В списке pgsql-patches по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: postgres-zh_TW.po for 7.5
Следующее
От: Tom Lane
Дата:
Сообщение: Re: psql latex bugfixes