Skip to content

Conversation

harukat
Copy link

@harukat harukat commented Jul 2, 2024

Variable pstr retrieved from function ptext_fetch() can be NULL due to various factors. Previously, pstr was passed as-is to each per-format process and used in strlen(), causing a crash when it was NULL.

This is a fix for #34 issue.
#34

Variable pstr retrieved from function ptext_fetch() can be NULL due to
various factors.  Previously, pstr was passed as-is to each per-format
process and used in strlen(), causing a crash when it was NULL.
@@ -1579,6 +1579,12 @@ pg_store_plans_internal(FunctionCallInfo fcinfo,
else
pstr = SHMEM_PLAN_PTR(entry);

if (pstr == NULL)
{
values[i++] = CStringGetTextDatum("<invalid plan>");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to set the value as null rather than adding another hardcoded value that users will have to explicitly check.

Also, since the code is not that complicated it would be better to avoid a gotoand just nest the instructions.

@@ -1612,10 +1618,13 @@ pg_store_plans_internal(FunctionCallInfo fcinfo,
pfree(mstr);

/* pstr is a pointer onto pbuffer */

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please avoid some unrelated changes like that.

@rjuju rjuju self-assigned this Feb 5, 2025
@rjuju rjuju added the bug label Feb 6, 2025
@rjuju rjuju removed their assignment Feb 28, 2025
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.

2 participants