AddressSanitizer: stack-use-after-scope on address in CreateBackgroundJob (#7949)

Var jobTypeName is created on stack and its value over pointer is used
in heap_form_tuple, so we
have stack use out of scope.
Issue was detected with adress sanitizer.

Fixes #7943.
pull/7948/head^2
manaldush 2025-04-04 16:03:41 +03:00 committed by GitHub
parent 1dc60e38bb
commit f084b79a4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -3024,6 +3024,8 @@ CreateBackgroundJob(const char *jobType, const char *description)
/* insert new job */
Datum values[Natts_pg_dist_background_job] = { 0 };
bool isnull[Natts_pg_dist_background_job] = { 0 };
NameData jobTypeName = { 0 };
memset(isnull, true, sizeof(isnull));
int64 jobId = GetNextBackgroundJobsJobId();
@ -3036,7 +3038,6 @@ CreateBackgroundJob(const char *jobType, const char *description)
if (jobType)
{
NameData jobTypeName = { 0 };
namestrcpy(&jobTypeName, jobType);
InitFieldValue(Anum_pg_dist_background_job_job_type, values, isnull,
NameGetDatum(&jobTypeName));