postgres.git / summary / log / commit / refs

commit    a74aa0854d5e7c6c14c7d31f41bc7adc366f3ef7
Author:   Heikki Linnakangas <heikki.linnakangas@iki.fi>
Commit:   Noah Misch <noah@leadboat.com>
Date:     Mon Aug 10 13:38:35 2026 +0000
First released in: 14.24, 15.19, 16.15, 17.11, 18.6, 19.0

    Fix pg_trgm's picksplit function with all-true datums
    
    The CACHESIGN.sign field is a BITVECP, not a TRGM, so you should not
    use GETSIGN() on it. You don't get a compiler warning because the
    GETSIGN() macro includes a cast. It resulted in a bogus read beyond
    end of buffer, which would cause bad split decisions or a crash if
    you're very unlucky.
    
    Reported-by: Mehmet D. INCE <mehmet@mehmetince.net>
    Backpatch-through: 14
    Security: CVE-2026-14678


contrib/pg_trgm/trgm_gist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/pg_trgm/trgm_gist.c b/contrib/pg_trgm/trgm_gist.c index 711413df491..7565d03d673 100644 --- a/contrib/pg_trgm/trgm_gist.c +++ b/contrib/pg_trgm/trgm_gist.c @@ -893,7 +893,7 @@ gtrgm_picksplit(PG_FUNCTION_ARGS) else size_alpha = SIGLENBIT(siglen) - sizebitvec((cache[j].allistrue) ? GETSIGN(datum_l) : - GETSIGN(cache[j].sign), + cache[j].sign, siglen); } else @@ -906,7 +906,7 @@ gtrgm_picksplit(PG_FUNCTION_ARGS) else size_beta = SIGLENBIT(siglen) - sizebitvec((cache[j].allistrue) ? GETSIGN(datum_r) : - GETSIGN(cache[j].sign), + cache[j].sign, siglen); } else [parent: 70a3b4e1831c]