From 9fd3141c6b2b4d61e28df3cb7d2a28463b7d71d8 Mon Sep 17 00:00:00 2001 From: Zsolt Parragi Date: Fri, 5 Dec 2025 19:48:11 +0000 Subject: [PATCH] Fix resp_calls array size This got broken during a refactoring in de71282922. We need the plus 2 items because of the overflow/underflow bucket, without that we can possibly overindex this array and corrupt other counters. In earlier versions we even had the encoding variable stored directly after this array, which possibly caused crashes or incorrectly working string functions. --- pg_stat_monitor.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pg_stat_monitor.h b/pg_stat_monitor.h index 8cf5959..e869a82 100644 --- a/pg_stat_monitor.h +++ b/pg_stat_monitor.h @@ -326,8 +326,9 @@ typedef struct Counters JitInfo jitinfo; ErrorInfo error; Wal_Usage walusage; - int resp_calls[MAX_RESPONSE_BUCKET]; /* execution time's in - * msec */ + int resp_calls[MAX_RESPONSE_BUCKET + 2]; /* execution time's in + * msec; including 2 + * outlier buckets */ int64 parallel_workers_to_launch; /* # of parallel workers planned * to be launched */ int64 parallel_workers_launched; /* # of parallel workers actually