postgresql/contrib/pg_trgm
John Naylor 176dffdf7d Fix various instances of undefined behavior
Mostly this involves checking for NULL pointer before doing operations
that add a non-zero offset.

The exception is an overflow warning in heap_fetch_toast_slice(). This
was caused by unneeded parentheses forcing an expression to be
evaluated to a negative integer, which then got cast to size_t.

Per clang 21 undefined behavior sanitizer.

Backpatch to all supported versions.

Co-authored-by: Alexander Lakhin <exclusion@gmail.com>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/777bd201-6e3a-4da0-a922-4ea9de46a3ee@gmail.com
Backpatch-through: 14
2026-02-04 18:09:35 +07:00
..
data Add files forgotten in f576b17cd6 2016-03-16 19:23:41 +03:00
expected Force standard_conforming_strings to always be ON. 2026-01-21 15:08:38 -05:00
sql Force standard_conforming_strings to always be ON. 2026-01-21 15:08:38 -05:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
Makefile Handle equality operator in contrib/pg_trgm 2020-11-15 08:52:35 +03:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_trgm--1.0--1.1.sql Fix typo in update scripts for some contrib modules. 2013-07-19 04:13:01 +09:00
pg_trgm--1.1--1.2.sql Add word_similarity to pg_trgm contrib module. 2016-03-16 18:59:21 +03:00
pg_trgm--1.2--1.3.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:42 -04:00
pg_trgm--1.3--1.4.sql Add strict_word_similarity to pg_trgm module 2018-03-21 14:57:42 +03:00
pg_trgm--1.3.sql Remove support for upgrading extensions from "unpackaged" state. 2020-02-19 16:59:14 -05:00
pg_trgm--1.4--1.5.sql Fix typo in contrib/pg_trgm/pg_trgm--1.4--1.5.sql 2020-11-12 08:55:09 +03:00
pg_trgm--1.5--1.6.sql Handle equality operator in contrib/pg_trgm 2020-11-15 08:52:35 +03:00
pg_trgm.control Handle equality operator in contrib/pg_trgm 2020-11-15 08:52:35 +03:00
trgm.h Fix an issue with index scan using pg_trgm due to char signedness on different architectures. 2025-02-21 10:27:39 -08:00
trgm_gin.c Mark commented out code as unused 2026-01-22 12:44:07 +01:00
trgm_gist.c Fix various instances of undefined behavior 2026-02-04 18:09:35 +07:00
trgm_op.c Use palloc_object() and palloc_array(), the last change 2025-12-11 14:29:12 +09:00
trgm_regexp.c Update copyright for 2026 2026-01-01 13:24:10 -05:00