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
1 change: 1 addition & 0 deletions src/standalones/s_bmqfuzz/package/s_bmqfuzz.mem
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ s_bmqfuzz_bmqp_ackmessageiterator.fuzz
s_bmqfuzz_bmqp_confirmmessageiterator.fuzz
s_bmqfuzz_bmqp_crc32c.fuzz
s_bmqfuzz_bmqp_event_initialize.fuzz
s_bmqfuzz_bmqp_messageproperties_streamin.fuzz
s_bmqfuzz_bmqp_pushmessageiterator.fuzz
s_bmqfuzz_bmqp_putmessageiterator.fuzz
s_bmqfuzz_bmqp_recoverymessageiterator.fuzz
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2026 Bloomberg Finance L.P.
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <bdlbb_blob.h>
#include <bdlbb_blobutil.h>
#include <bdlbb_pooledblobbufferfactory.h>
#include <bslma_default.h>

#include <bmqp_messageproperties.h>

using namespace BloombergLP;

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
if (size < sizeof(bmqp::MessagePropertiesHeader) + 1) {
return 0;
}

bool isNewStyle = (data[0] & 1);
data++;
size--;

bslma::Allocator* alloc = bslma::Default::defaultAllocator();
bdlbb::PooledBlobBufferFactory bufferFactory(1024, alloc);

bdlbb::Blob blob(&bufferFactory, alloc);
bdlbb::BlobUtil::append(&blob,
reinterpret_cast<const char*>(data),
static_cast<int>(size));

bmqp::MessageProperties props(alloc);
int rc = props.streamIn(blob, isNewStyle);
if (rc != 0) {
return 0;
}

props.numProperties();
props.totalSize();

return 0;
}
Loading