mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-12-28 17:09:24 -05:00
enable pointer cast warnings
This commit is contained in:
parent
9a43302868
commit
ac8c68de53
2
Makefile
2
Makefile
@ -2,7 +2,7 @@ CONFIG_CXX_ALLOCATOR := true
|
||||
CONFIG_UBSAN := false
|
||||
|
||||
CPPFLAGS := -D_GNU_SOURCE
|
||||
SHARED_FLAGS := -O2 -flto -fPIC -fvisibility=hidden -fno-plt -pipe -Wall -Wextra
|
||||
SHARED_FLAGS := -O2 -flto -fPIC -fvisibility=hidden -fno-plt -pipe -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings
|
||||
CFLAGS := -std=c11 $(SHARED_FLAGS) -Wmissing-prototypes
|
||||
CXXFLAGS := -std=c++14 $(SHARED_FLAGS)
|
||||
LDFLAGS := -Wl,-z,defs,-z,relro,-z,now,-z,nodlopen,-z,text
|
||||
|
4
malloc.c
4
malloc.c
@ -296,13 +296,13 @@ static void *slot_pointer(size_t size, void *slab, size_t slot) {
|
||||
return (char *)slab + slot * size;
|
||||
}
|
||||
|
||||
static void write_after_free_check(const char *p, size_t size) {
|
||||
static void write_after_free_check(const void *p, size_t size) {
|
||||
if (!WRITE_AFTER_FREE_CHECK) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < size; i += sizeof(u64)) {
|
||||
if (*(u64 *)(p + i)) {
|
||||
if (*(const u64 *)(p + i)) {
|
||||
fatal_error("detected write after free");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user