| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Fixes a clip bug in pg_stat_get_backend_activity() |
| Date: | 2025-12-26 03:54:38 |
| Message-ID: | CAEoWx2mDzwc48q2EK9tSXS6iJMJ35wvxNQnHX+rXjy5VgLvJQw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Hackers,
This is an eyeball caught bug:
```
clipped_activity = pgstat_clip_activity(activity);
ret = cstring_to_text(activity); <== bug here: should use clipped_activity
pfree(clipped_activity);
PG_RETURN_TEXT_P(ret);
```
clipped result is stored in clipped_activity, but it's not used.
This should be an edge case bug. It would only be triggered by using
multi-byte characters in SQL and the SQL statement length
exceeds track_activity_query_size, and a multi-byte character just across
the boundary and gets truncated in the middle.
I tried to reproduce the bug, but failed. Anyway, this is an obvious fix,
no logic change.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fixes-a-clip-bug-in-pg_stat_get_backend_activity.patch | application/octet-stream | 1.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Shinya Kato | 2025-12-26 05:34:01 | Re: Report oldest xmin source when autovacuum cannot remove tuples |
| Previous Message | Hayato Kuroda (Fujitsu) | 2025-12-26 03:52:09 | RE: Parallel Apply |