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;
test=# savepoint "A";
test=# rollback to a;
server closed the connection unexpectedly


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.

        Jeff Davis

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

                /* we don't cross savepoint level boundaries */
-               if (target->savepointLevel != s->savepointLevel)
+               if (PointerIsValid(target) && (target->savepointLevel !=
                                         errmsg("no such savepoint")));

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?


Reply via email to