Bug #80464
closedrgw/amqp: out of bounds read when an ack covers every pending callback
0%
Description
A broker can confirm several messages at once with the "multiple" flag on basic.ack or basic.nack, which acks every delivery tag up to and including the one in the frame. The loop that fires those callbacks in Manager::run(), src/rgw/rgw_amqp.cc, dereferences the iterator before checking it:
auto it = conn->callbacks.begin();
while (it->tag <= tag && it != conn->callbacks.end()) {
it->cb(result);
it = conn->callbacks.erase(it);
}
erase() returns end() once the last callback is gone, so the next round reads past the end. Getting there takes an ack that covers every callback pending on the connection, since a std::find for the exact tag guards the loop.
It has not crashed, and the loop still stops where it should. CallbackList is a std::vector and erase() does not shrink the buffer, so end() points at a slot that is still part of the allocation and holds the moved-from copy of the element just shifted out. tag is a uint64_t that move assignment copies, so it->tag reads the old last tag, the first condition is true, and the it != end() check ends the loop.
UB Updated by Upkeep Bot 3 months ago
- Status changed from Fix Under Review to Pending Backport
- Merge Commit set to 5d671cefc028606aabae3027542436b7eaf55b39
- Fixed In set to v21.3.0-3185-g5d671cefc0
- Upkeep Timestamp set to 2026-09-11T09:44:46+00:00
UB Updated by Upkeep Bot 3 months ago
- Copied to Backport #80471: squid: rgw/amqp: out of bounds read when an ack covers every pending callback added
UB Updated by Upkeep Bot 3 months ago
- Copied to Backport #80472: tentacle: rgw/amqp: out of bounds read when an ack covers every pending callback added
UB Updated by Upkeep Bot 3 months ago
- Copied to Backport #80473: umbrella: rgw/amqp: out of bounds read when an ack covers every pending callback added
UB Updated by Upkeep Bot 3 months ago
- Status changed from Pending Backport to Backporting
- Upkeep Timestamp changed from 2026-09-11T09:44:46+00:00 to 2026-09-11T12:26:00+00:00
UB Updated by Upkeep Bot 18 days ago
- Status changed from Backporting to Resolved
- Upkeep Timestamp changed from 2026-09-11T12:26:00+00:00 to 2026-11-15T01:07:36+00:00