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

Commitf94eec4

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 parent7d3583a commitf94eec4

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
@@ -597,7 +597,7 @@ ExecInitParallelPlan(PlanState *planstate, EState *estate,
597597

598598
/* Estimate space for query text. */
599599
query_len=strlen(estate->es_sourceText);
600-
shm_toc_estimate_chunk(&pcxt->estimator,query_len);
600+
shm_toc_estimate_chunk(&pcxt->estimator,query_len+1);
601601
shm_toc_estimate_keys(&pcxt->estimator,1);
602602

603603
/* Estimate space for serialized PlannedStmt. */
@@ -672,8 +672,8 @@ ExecInitParallelPlan(PlanState *planstate, EState *estate,
672672
shm_toc_insert(pcxt->toc,PARALLEL_KEY_EXECUTOR_FIXED,fpes);
673673

674674
/* Store query string */
675-
query_string=shm_toc_allocate(pcxt->toc,query_len);
676-
memcpy(query_string,estate->es_sourceText,query_len);
675+
query_string=shm_toc_allocate(pcxt->toc,query_len+1);
676+
memcpy(query_string,estate->es_sourceText,query_len+1);
677677
shm_toc_insert(pcxt->toc,PARALLEL_KEY_QUERY_TEXT,query_string);
678678

679679
/* Store serialized PlannedStmt. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp