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

Appearance settings

Commit f94eec4

Browse filesBrowse files
committed
When passing query strings to workers, pass the terminating \0.
Otherwise, when the query string is read, we might trailing garbage beyond 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 parent 7d3583a commit f94eec4
Copy full SHA for f94eec4

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

‎src/backend/executor/execParallel.c

Copy file name to clipboardExpand all lines: src/backend/executor/execParallel.c
+3-3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.