Skip to content

Conversation

@ProjectMutilation
Copy link

Previously, when iterating through an agtype container, the code would access elem->val even when elem was null.
This adds a null check to set the result type to AGTV_NULL when the element is null, preventing a potential segmentation fault.

Fixes: 4274f10 ("Added the toStringList() function (#1084)")
Found by PostgresPro.

@ProjectMutilation ProjectMutilation force-pushed the utils-adt-avoid-potential-null-deref branch from e68f7bb to 535e5ea Compare January 21, 2026 13:49
Previously, when iterating through an agtype container, the code would
access `elem->val` even when `elem` was null.
This adds a null check to set the result type to AGTV_NULL when the
element is null, preventing a potential segmentation fault.

Fixes: 4274f10 ("Added the toStringList() function (apache#1084)")
Found by PostgresPro.
Signed-off-by: Maksim Korotkov <m.korotkov@postgrespro.ru>
@ProjectMutilation ProjectMutilation force-pushed the utils-adt-avoid-potential-null-deref branch from 535e5ea to 57bf50d Compare January 21, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant