// Copyright Epic Games, Inc. All Rights Reserved. #include #include #include namespace zen { CbObject ValidateAndReadCompactBinaryObject(const SharedBuffer&& Payload, CbValidateError& OutError) { if (Payload.GetSize() > 0) { if (OutError = ValidateCompactBinary(Payload.GetView(), CbValidateMode::Default); OutError == CbValidateError::None) { CbObject Object(Payload); if (Object.GetView().GetSize() != Payload.GetSize()) { OutError |= CbValidateError::OutOfBounds; return {}; } return Object; } } return CbObject(); } CbObject ValidateAndReadCompactBinaryObject(const CompressedBuffer&& Payload, CbValidateError& OutError) { if (CompositeBuffer Decompressed = Payload.DecompressToComposite()) { return ValidateAndReadCompactBinaryObject(std::move(Decompressed).Flatten(), OutError); } return CbObject(); } } // namespace zen