mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-12-18 12:24:27 -05:00
avoid unnecessary GNU pointer arithmetic extension
This commit is contained in:
parent
7f781af929
commit
7917966eca
@ -381,13 +381,13 @@ static void *slot_pointer(size_t size, void *slab, size_t slot) {
|
|||||||
return (char *)slab + slot * size;
|
return (char *)slab + slot * size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_after_free_check(const void *p, size_t size) {
|
static void write_after_free_check(const char *p, size_t size) {
|
||||||
if (!WRITE_AFTER_FREE_CHECK) {
|
if (!WRITE_AFTER_FREE_CHECK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < size; i += sizeof(u64)) {
|
for (size_t i = 0; i < size; i += sizeof(u64)) {
|
||||||
if (*(const u64 *)(p + i)) {
|
if (*(const u64 *)(const void *)(p + i)) {
|
||||||
fatal_error("detected write after free");
|
fatal_error("detected write after free");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user