Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ydb/core/base/blobstorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,8 @@ struct TEvBlobStorage {
Y_ABORT_UNLESS(sh < id.BlobSize(),
"Please, don't read behind the end of the blob! BlobSize# %" PRIu32 " sh# %" PRIu32,
(ui32)id.BlobSize(), (ui32)sh);
Y_ABORT_UNLESS(TErasureType::IsCrcModeValid(id.CrcMode()),
"Please, set correct CrcMode for query, CrcMode# %" PRIu32, id.CrcMode());
}

TString ToString() const {
Expand Down
9 changes: 9 additions & 0 deletions ydb/core/blobstorage/vdisk/query/query_public.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ namespace NKikimr {
if (record.ExtremeQueriesSize() == 0)
return false; // we need to have one

for (const auto& query : record.GetExtremeQueries()) {
TLogoBlobID blobId = LogoBlobIDFromLogoBlobID(query.GetId());
if (!TErasureType::IsCrcModeValid(blobId.CrcMode())) {
// We shouldn't be able to create TEvGet request with invalid CrcMode at all
// something went wrong
return false;
}
}

return true;
}

Expand Down
10 changes: 10 additions & 0 deletions ydb/core/erasure/erasure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3206,6 +3206,16 @@ void TErasureType::RestoreData(ECrcMode crcMode, TDataPartSet& partSet, bool res
}
}

bool TErasureType::IsCrcModeValid(ui32 crcModeRaw) {
switch (crcModeRaw) {
case static_cast<ui32>(ECrcMode::CrcModeNone):
case static_cast<ui32>(ECrcMode::CrcModeWholePart):
return true;
default:
return false;
}
}

} // NKikimr

Y_DECLARE_OUT_SPEC(, NKikimr::TErasureType::EErasureSpecies, stream, value) {
Expand Down
1 change: 1 addition & 0 deletions ydb/core/erasure/erasure.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ struct TErasureType {
ui64 BlockSplitPartUsedSize(ui64 dataSize, ui32 partIdx) const;
ui32 BlockSplitPartIndex(ui64 offset, ui64 dataSize, ui64 &outPartOffset) const;
ui64 BlockSplitWholeOffset(ui64 dataSize, ui64 partIdx, ui64 offset) const;
static bool IsCrcModeValid(ui32 crcModeRaw);

static const std::array<TString, ErasureSpeciesCount> ErasureName;
protected:
Expand Down
Loading