Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7be0d77

Browse files
committed
When passing query strings to workers, pass the terminating \0.
Otherwise, when the query string is read, we might trailing garbagebeyond the end, unless there happens to be a \0 there by good luck.Report and patch by Thomas Munro. Reviewed by Rafia Sabih.Discussion:http://postgr.es/m/CAEepm=2SJs7X+_vx8QoDu8d1SMEOxtLhxxLNzZun_BvNkuNhrw@mail.gmail.com
1 parent72567f6 commit7be0d77

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/backend/executor/execParallel.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ ExecInitParallelPlan(PlanState *planstate, EState *estate, int nworkers)
410410

411411
/* Estimate space for query text. */
412412
query_len=strlen(estate->es_sourceText);
413-
shm_toc_estimate_chunk(&pcxt->estimator,query_len);
413+
shm_toc_estimate_chunk(&pcxt->estimator,query_len+1);
414414
shm_toc_estimate_keys(&pcxt->estimator,1);
415415

416416
/* Estimate space for serialized PlannedStmt. */
@@ -478,8 +478,8 @@ ExecInitParallelPlan(PlanState *planstate, EState *estate, int nworkers)
478478
*/
479479

480480
/* Store query string */
481-
query_string=shm_toc_allocate(pcxt->toc,query_len);
482-
memcpy(query_string,estate->es_sourceText,query_len);
481+
query_string=shm_toc_allocate(pcxt->toc,query_len+1);
482+
memcpy(query_string,estate->es_sourceText,query_len+1);
483483
shm_toc_insert(pcxt->toc,PARALLEL_KEY_QUERY_TEXT,query_string);
484484

485485
/* Store serialized PlannedStmt. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp