Skip to content

Commit

Permalink
Test code with UB sanitiser, remove unwanted null (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
msm-code authored May 15, 2020
1 parent 02d0c5d commit 8fc3f6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libursa/OnDiskIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void OnDiskIndex::on_disk_merge_core(

// Arbitrary number describing how much RAM we want to spend on the run
// cache during the batched stream pass.
constexpr uint64_t MAX_BATCH_BYTES = 2ULL * 1024ULL * 1024ULL * 1024ULL;
constexpr uint64_t MAX_BATCH_BYTES = 1024ULL * 1024ULL * 1024ULL;

// Vector used for all merge passes (to avoid unnecessary reallocations).
std::vector<uint8_t> batch_vector(MAX_BATCH_BYTES);
Expand Down
4 changes: 3 additions & 1 deletion libursa/ZHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
bool s_send_raw(zmq::socket_t *socket, std::string_view payload,
int flags = 0) {
zmq::message_t message(payload.size());
::memcpy(message.data(), payload.data(), payload.size());
if (payload.size()) {
::memcpy(message.data(), payload.data(), payload.size());
}
return socket->send(message, flags);
}

Expand Down

0 comments on commit 8fc3f6f

Please sign in to comment.