зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #18751 - Poison hashtable buffers (from bholley:poison_hashtable); r=Manishearth
This gives us extra defense in depth. Source-Repo: https://github.com/servo/servo Source-Revision: 2bbc458c5b2ad44d008cfa57415fe41d1a7ada5e --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : b4c8722fd8a88da9c8d3f21b600085da637e9a9e
This commit is contained in:
Родитель
ef46bde5d2
Коммит
64bac56a29
|
@ -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 {
|
||||
|
|
Загрузка…
Ссылка в новой задаче