yjhjstz commented on code in PR #1351:
URL: https://github.com/apache/cloudberry/pull/1351#discussion_r2981610090


##########
contrib/interconnect/udp/ic_udpifc.c:
##########
@@ -1406,7 +1419,10 @@ static CursorICHistoryEntry *
 getCursorIcEntry(CursorICHistoryTable *t, uint32 icId)
 {
        struct CursorICHistoryEntry *p;
-       uint8           index = icId % CURSOR_IC_TABLE_SIZE;
+       uint8           index;
+
+       Assert(t->size > 0);
+       index = icId % t->size;

Review Comment:
   uint8 -> uint32
   
   For example, with t->size = 512 and icId = 300: 300 % 512 = 300, but uint8 
wraps to 44 — accessing the
   wrong hash bucket. This means lookups, updates, and prunes will operate on 
incorrect entries.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to