librdkafka icon indicating copy to clipboard operation
librdkafka copied to clipboard

Potential Integer Overflow / Redudant Code

Open stasos24 opened this issue 7 months ago • 0 comments

Since: first_seq has int32_t type https://github.com/confluentinc/librdkafka/blob/93877617709eb071a0f4ec7038c54e2764abefc9/src/rdkafka_msgbatch.h#L37 and rd_kafka_msgq_len return int(int32) https://github.com/confluentinc/librdkafka/blob/93877617709eb071a0f4ec7038c54e2764abefc9/src/rdkafka_msg.h#L244-L246 But rd_kafka_seq_wrap accepts int64_t as argument https://github.com/confluentinc/librdkafka/blob/93877617709eb071a0f4ec7038c54e2764abefc9/src/rdkafka_msg.h#L594-L596 There could be overflow at https://github.com/confluentinc/librdkafka/blob/93877617709eb071a0f4ec7038c54e2764abefc9/src/rdkafka_request.c#L4655-L4656

If there's no overflow then what's the point of calling rd_kafka_seq_wrap cause argument has int32 and return has int32 and rd_kafka_seq_wrap merely cuts high part of int64

stasos24 avatar Mar 09 '25 18:03 stasos24