Skip to content

Commit f7cbca1

Browse files
jiaqizhomy-ship-it
authored andcommitted
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.
1 parent bc7011b commit f7cbca1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

contrib/interconnect/ic_common.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,14 +541,15 @@ GetMotionSentRecordTypmod(ChunkTransportState * transportStates,
541541
int16 motNodeID,
542542
int16 targetRoute)
543543
{
544-
MotionConn *conn;
544+
MotionConn *conn = NULL;
545545
ChunkTransportStateEntry *pEntry = NULL;
546546
getChunkTransportState(transportStates, motNodeID, &pEntry);
547547

548-
if (targetRoute == BROADCAST_SEGIDX)
549-
conn = &pEntry->conns[0];
550-
else
551-
conn = &pEntry->conns[targetRoute];
548+
if (targetRoute == BROADCAST_SEGIDX) {
549+
targetRoute = 0;
550+
}
551+
552+
getMotionConn(pEntry, targetRoute, &conn);
552553

553554
return &conn->sent_record_typmod;
554555
}

0 commit comments

Comments
 (0)