Skip to content

Commit 07afdc1

Browse files
committed
rgw: handle bad/unknown checksum case in cksum::Factory
Signed-off-by: Matt Benjamin <[email protected]>
1 parent 51140d6 commit 07afdc1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/rgw/rgw_cksum_pipe.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ namespace rgw::putobj {
4343
if (algo_header.first) {
4444
if (algo_header.second) {
4545
auto cksum_type = cksum::parse_cksum_type(algo_header.second);
46-
return
47-
std::make_unique<RGWPutObj_Cksum>(
48-
next, cksum_type, std::move(algo_header));
46+
/* unknown checksum type in header */
47+
if (cksum_type != rgw::cksum::Type::none) {
48+
return
49+
std::make_unique<RGWPutObj_Cksum>(
50+
next, cksum_type, std::move(algo_header));
51+
} else {
52+
return std::unique_ptr<RGWPutObj_Cksum>();
53+
}
4954
}
5055
/* malformed checksum algorithm header(s) */
5156
throw rgw::io::Exception(EINVAL, std::system_category());

0 commit comments

Comments
 (0)