Skip to content

Commit

Permalink
Fix a possible ownership bug
Browse files Browse the repository at this point in the history
Summary:
I don't know whether this leads to the crash we've seen, but it seems
to be a bug: when we deserialize a set we're adding 8 junk bytes at
the end.

Reviewed By: malanka

Differential Revision: D66573036

fbshipit-source-id: 7c7a22626056204554bfdd49101e11276c52d70a
  • Loading branch information
Simon Marlow authored and facebook-github-bot committed Nov 28, 2024
1 parent cb598b5 commit 03a0133
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions glean/rocksdb/ownership.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@ std::unique_ptr<rts::OwnershipSetIterator> getSetIterator(DatabaseImpl& db) {
auto usetid = key.trustedNat();
// EliasFano needs to be able to read 8 bytes past the end of
// the data, so we have to copy the bytes to add padding.
const size_t pad = 8;
bytes = hs::ffi::clone_array<uint8_t>(
reinterpret_cast<const uint8_t*>(iter->value().data()),
iter->value().size(),
8);
binary::Input val(bytes.get(), bytes.size());
pad);
binary::Input val(bytes.get(), iter->value().size());
exp.op = static_cast<SetOp>(val.trustedNat());
exp.set = deserializeEliasFano(val);
return std::pair<uint32_t, SetExpr<const OwnerSet*>>(
Expand Down

0 comments on commit 03a0133

Please sign in to comment.