]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: handle bad/unknown checksum case in cksum::Factory
authorMatt Benjamin <mbenjamin@redhat.com>
Mon, 17 Feb 2025 21:30:26 +0000 (16:30 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Wed, 26 Mar 2025 19:30:03 +0000 (15:30 -0400)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_cksum_pipe.cc

index 0bec8d341af078bbc3eca7f20c90c1126b35c599..32b93755f5d8fdb8ec86ca6322b7ad0bb04440d1 100644 (file)
@@ -43,9 +43,14 @@ namespace rgw::putobj {
     if (algo_header.first) {
       if (algo_header.second) {
        auto cksum_type = cksum::parse_cksum_type(algo_header.second);
-       return
-         std::make_unique<RGWPutObj_Cksum>(
-                                   next, cksum_type, std::move(algo_header));
+       /* unknown checksum type in header */
+       if (cksum_type != rgw::cksum::Type::none) {
+         return
+           std::make_unique<RGWPutObj_Cksum>(
+                              next, cksum_type, std::move(algo_header));
+       } else {
+         return std::unique_ptr<RGWPutObj_Cksum>();
+       }
       }
       /* malformed checksum algorithm header(s) */
       throw rgw::io::Exception(EINVAL, std::system_category());