Skip to content

Commit

Permalink
Poison hashtable buffers.
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 8uLGtFv6X4P
  • Loading branch information
bholley committed Oct 4, 2017
1 parent 3f07cfe commit c866486
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/hashglobe/src/table.rs
Expand Up @@ -777,13 +777,16 @@ impl<K, V> RawTable<K, V> {


// FORK NOTE: Uses alloc shim instead of Heap.alloc
let buffer = alloc(size, alignment);
let buffer: *mut u8 = alloc(size, alignment);

if buffer.is_null() {

return Err(FailedAllocationError { reason: "out of memory when allocating RawTable" });
}

// FORK NOTE: poison the entire buffer rather than leaving it uninitialized.
ptr::write_bytes(buffer, 0xe7, size);

let hashes = buffer.offset(hash_offset as isize) as *mut HashUint;

Ok(RawTable {
Expand Down

0 comments on commit c866486

Please sign in to comment.