Poison hashtable buffers.

MozReview-Commit-ID: 8uLGtFv6X4P
This commit is contained in:
Bobby Holley 2017-10-04 15:52:57 -07:00
parent 3f07cfec7c
commit c866486b99

View file

@ -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 {