]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
option for resolution of valgrind:InvalidRead. verifying the length of string
authorGal Salomon <gal.salomon@gmail.com>
Tue, 30 Jul 2024 16:08:44 +0000 (19:08 +0300)
committerGal Salomon <gal.salomon@gmail.com>
Tue, 6 Aug 2024 12:06:41 +0000 (15:06 +0300)
Signed-off-by: Gal Salomon <gal.salomon@gmail.com>
src/rgw/rgw_s3select.cc

index e2e88dfae30936b5fe84fef66a3a99430763a779..d30fac1e457f642f77bd7c1b2e542818c8b35ddd 100644 (file)
@@ -807,6 +807,11 @@ int RGWSelectObj_ObjStore_S3::parquet_processing(bufferlist& bl, off_t ofs, off_
       }
       append_in_callback += it.length();
       ldout(s->cct, 10) << "S3select: part " << part_no++ << " it.length() = " << it.length() << dendl;
+      if ((ofs + len) > it.length()){
+       ldpp_dout(this, 10) << "s3select: offset and length may cause invalid read: ofs = " << ofs << " len = " << len << " it.length() = " << it.length() << dendl;
+       ofs = 0;
+       len = it.length();
+      }
       requested_buffer.append(&(it)[0]+ofs, len);
     }
     ldout(s->cct, 10) << "S3select:append_in_callback = " << append_in_callback << dendl;