Content-Length: 282038 | pFad | http://github.com/postgrespro/postgres_cluster/commit/f94eec490b2671399c102b89c9fa0311aea3a39f

E6 When passing query strings to workers, pass the terminating \0. · postgrespro/postgres_cluster@f94eec4 · GitHub
Skip to content

Commit f94eec4

Browse 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

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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/f94eec490b2671399c102b89c9fa0311aea3a39f

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy