From 16e477d2099044c4df5114877e18abb9d0172b8b Mon Sep 17 00:00:00 2001 From: Seena Fallah Date: Tue, 25 Nov 2025 19:22:44 +0100 Subject: [PATCH] rgw: fix offset calculation in copy_obj_data Set ofs to total bytes read by adding 1 to end offset. Since 'end' represents the last byte offset (zero-indexed), we need to add 1 to get the actual number of bytes copied. Signed-off-by: Seena Fallah --- src/rgw/driver/rados/rgw_rados.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index c1e49706213..21709b08c73 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -5372,7 +5372,9 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx, return ret; } - ofs = end; + // set ofs to the total bytes read + // `end` is always the last byte offset, so add 1 + ofs = end + 1; // flush ret = filter->flush(); -- 2.47.3