mirror of https://github.com/citusdata/citus.git
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
parent
1dc60e38bb
commit
f084b79a4b
|
@ -3024,6 +3024,8 @@ CreateBackgroundJob(const char *jobType, const char *description)
|
||||||
/* insert new job */
|
/* insert new job */
|
||||||
Datum values[Natts_pg_dist_background_job] = { 0 };
|
Datum values[Natts_pg_dist_background_job] = { 0 };
|
||||||
bool isnull[Natts_pg_dist_background_job] = { 0 };
|
bool isnull[Natts_pg_dist_background_job] = { 0 };
|
||||||
|
|
||||||
|
NameData jobTypeName = { 0 };
|
||||||
memset(isnull, true, sizeof(isnull));
|
memset(isnull, true, sizeof(isnull));
|
||||||
|
|
||||||
int64 jobId = GetNextBackgroundJobsJobId();
|
int64 jobId = GetNextBackgroundJobsJobId();
|
||||||
|
@ -3036,7 +3038,6 @@ CreateBackgroundJob(const char *jobType, const char *description)
|
||||||
|
|
||||||
if (jobType)
|
if (jobType)
|
||||||
{
|
{
|
||||||
NameData jobTypeName = { 0 };
|
|
||||||
namestrcpy(&jobTypeName, jobType);
|
namestrcpy(&jobTypeName, jobType);
|
||||||
InitFieldValue(Anum_pg_dist_background_job_job_type, values, isnull,
|
InitFieldValue(Anum_pg_dist_background_job_job_type, values, isnull,
|
||||||
NameGetDatum(&jobTypeName));
|
NameGetDatum(&jobTypeName));
|
||||||
|
|
Loading…
Reference in New Issue