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
|
CONFIG_UBSAN := false
|
||||||
|
|
||||||
CPPFLAGS := -D_GNU_SOURCE
|
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
|
CFLAGS := -std=c11 $(SHARED_FLAGS) -Wmissing-prototypes
|
||||||
CXXFLAGS := -std=c++14 $(SHARED_FLAGS)
|
CXXFLAGS := -std=c++14 $(SHARED_FLAGS)
|
||||||
LDFLAGS := -Wl,-z,defs,-z,relro,-z,now,-z,nodlopen,-z,text
|
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;
|
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) {
|
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 (*(u64 *)(p + i)) {
|
if (*(const u64 *)(p + i)) {
|
||||||
fatal_error("detected write after free");
|
fatal_error("detected write after free");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user