A heap-based buffer overflow vulnerability exists in PostgreSQL's ts_rank_cd() function. This flaw may allow a database user to execute arbitrary code with the privileges of the operating system user running the database. The issue is triggered by an invalid tsvector containing duplicate positions. Versions prior to PostgreSQL 14.25, 15.20, 16.16, 17.12, and 18.7 are affected. A patch is available in these fixed versions.