Skip to content

Commit 438467a

Browse files
authored
Merge pull request #25 from MakSl/fix_hangup
[PGPRO-5172] Fixed infinite looping in the receive_msg_by_parts function
2 parents 873f877 + 5a9f8b2 commit 438467a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pg_query_state.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,19 +970,21 @@ receive_msg_by_parts(shm_mq_handle *mqh, Size *total, void **datap,
970970
shm_mq_result mq_receive_result;
971971
shm_mq_msg *buff;
972972
int offset;
973-
int *expected;
973+
int *expected;
974+
int expected_data;
974975
Size len;
975976

976977
/* Get the expected number of bytes in message */
977978
mq_receive_result = shm_mq_receive(mqh, &len, (void **) &expected, nowait);
979+
expected_data = *expected;
978980
if (mq_receive_result != SHM_MQ_SUCCESS)
979981
return mq_receive_result;
980982
Assert(len == sizeof(int));
981983

982-
*datap = palloc0(*expected);
984+
*datap = palloc0(expected_data);
983985

984986
/* Get the message itself */
985-
for (offset = 0; offset < *expected; )
987+
for (offset = 0; offset < expected_data; )
986988
{
987989
/* Keep receiving new messages until we assemble the full message */
988990
mq_receive_result = shm_mq_receive(mqh, &len, ((void **) &buff), nowait);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy