mirror of
https://github.com/servo/servo.git
synced 2025-06-18 13:24:29 +00:00
Poison hashtable buffers.
MozReview-Commit-ID: 8uLGtFv6X4P
This commit is contained in:
parent
3f07cfec7c
commit
c866486b99
1 changed files with 4 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue