mirror of
https://github.com/postgres/postgres.git
synced 2025-06-22 02:52:08 +03:00
Fix dangling pointer problem in ReorderBufferSerializeChange.
Commit 3fe3511d05
introduced a new
case into this function, but neglected to ensure that the "ondisk"
pointer got updated after a possible reallocation as the code does
in other cases.
Stas Kelvich, per diagnosis by Konstantin Knizhnik.
This commit is contained in:
@ -2250,6 +2250,9 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
|
|||||||
|
|
||||||
data = ((char *) rb->outbuf) + sizeof(ReorderBufferDiskChange);
|
data = ((char *) rb->outbuf) + sizeof(ReorderBufferDiskChange);
|
||||||
|
|
||||||
|
/* might have been reallocated above */
|
||||||
|
ondisk = (ReorderBufferDiskChange *) rb->outbuf;
|
||||||
|
|
||||||
/* write the prefix including the size */
|
/* write the prefix including the size */
|
||||||
memcpy(data, &prefix_size, sizeof(Size));
|
memcpy(data, &prefix_size, sizeof(Size));
|
||||||
data += sizeof(Size);
|
data += sizeof(Size);
|
||||||
|
Reference in New Issue
Block a user