]> granicus.if.org Git - postgresql/commitdiff
Fix incorrect initialization of BackendActivityBuffer.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 7 Aug 2018 20:00:44 +0000 (16:00 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 7 Aug 2018 20:00:55 +0000 (16:00 -0400)
Since commit c8e8b5a6e, this has been zeroed out using the wrong length.
In practice the length would always be too small, leading to not zeroing
the whole buffer rather than clobbering additional memory; and that's
pretty harmless, both because shmem would likely start out as zeroes
and because we'd reinitialize any given entry before use.  Still,
it's bogus, so fix it.

Reported by Petru-Florin Mihancea (bug #15312)

Discussion: https://postgr.es/m/153363913073.1303.6518849192351268091@wrigleys.postgresql.org

src/backend/postmaster/pgstat.c

index 084573e77c0d29c9fd5eeb2b0f1c2457805615f8..10e7acce846f7f2a0c15dd3c75a6aa64d0a8e9b4 100644 (file)
@@ -2695,7 +2695,7 @@ CreateSharedBackendStatus(void)
 
        if (!found)
        {
-               MemSet(BackendActivityBuffer, 0, size);
+               MemSet(BackendActivityBuffer, 0, BackendActivityBufferSize);
 
                /* Initialize st_activity pointers. */
                buffer = BackendActivityBuffer;