]> granicus.if.org Git - postgresql/commitdiff
Fix crash in pg_replication_slot_advance
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 19 Feb 2018 21:00:53 +0000 (18:00 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 20 Feb 2018 01:25:27 +0000 (22:25 -0300)
We were trying to use a LSN variable after releasing its containing slot
structure.

Reported by: tushar
Author: amul sul
Reviewed-by: Petr Jelinek, Masahiko Sawada
Discussion: https://postgr.es/m/94ba999c-f76a-0423-6523-b8d531dfe4c7@enterprisedb.com

src/backend/replication/slotfuncs.c

index cf2195bc93fb53c40e32aa881a84215c93ded2c5..e873dd1f81a55d9b5b286738f78f45e7450ebcda 100644 (file)
@@ -480,8 +480,7 @@ pg_replication_slot_advance(PG_FUNCTION_ARGS)
                                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                 errmsg("cannot move slot to %X/%X, minimum is %X/%X",
                                                (uint32) (moveto >> 32), (uint32) moveto,
-                                               (uint32) (MyReplicationSlot->data.confirmed_flush >> 32),
-                                               (uint32) (MyReplicationSlot->data.confirmed_flush))));
+                                               (uint32) (startlsn >> 32), (uint32) startlsn)));
        }
 
        if (OidIsValid(MyReplicationSlot->data.database))