This is an automated email from the ASF dual-hosted git repository.

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/main by this push:
     new f7cbca14b94 Fix: invalid write in MotionConn when motion type is 
explicit redistribute motion
f7cbca14b94 is described below

commit f7cbca14b943624487dcc82722ce549e8e75aba6
Author: zhoujiaqi <[email protected]>
AuthorDate: Wed Jul 9 16:35:17 2025 +0800

    Fix: invalid write in MotionConn when motion type is explicit redistribute 
motion
    
    In the `GetMotionSentRecordTypmod` method, `MotionConn` is not call the 
CAST function,
    but directly accessed the object by index, which causes an invalid read 
inside array.
---
 contrib/interconnect/ic_common.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/contrib/interconnect/ic_common.c b/contrib/interconnect/ic_common.c
index d629eb09698..7e266b69efb 100644
--- a/contrib/interconnect/ic_common.c
+++ b/contrib/interconnect/ic_common.c
@@ -541,14 +541,15 @@ GetMotionSentRecordTypmod(ChunkTransportState * 
transportStates,
                                                   int16 motNodeID,
                                                   int16 targetRoute)
 {
-       MotionConn *conn;
+       MotionConn *conn = NULL;
        ChunkTransportStateEntry *pEntry = NULL;
        getChunkTransportState(transportStates, motNodeID, &pEntry);
 
-       if (targetRoute == BROADCAST_SEGIDX)
-               conn = &pEntry->conns[0];
-       else
-               conn = &pEntry->conns[targetRoute];
+       if (targetRoute == BROADCAST_SEGIDX) {
+               targetRoute = 0;
+       }
+
+       getMotionConn(pEntry, targetRoute, &conn);
 
        return &conn->sent_record_typmod;
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to