From 06929a556fdc39c8fe12965b69070c8df520a33e Mon Sep 17 00:00:00 2001 From: Tom Anderson Date: Fri, 10 Feb 2023 23:53:15 +0000 Subject: Fix false-positive CFI failure When building Chromium with upstream Fontconfig with CFI, the following build error is raised: ../../third_party/fontconfig/src/src/fchash.c:105:21: runtime error: control flow integrity check for type 'unsigned int (const void *)' failed during indirect function call This occurs because CFI doesn't like the conversion from `unsigned int (const void *)` to `unsigned int (const char *)`. To fix this, simply redefine `FcHashFunc` to use `char *` instead. --- src/fcint.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fcint.h b/src/fcint.h index 78cee54..0c5f5e7 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -408,8 +408,8 @@ typedef struct _FcStrBuf { typedef struct _FcHashTable FcHashTable; -typedef FcChar32 (* FcHashFunc) (const void *data); -typedef int (* FcCompareFunc) (const void *v1, const void *v2); +typedef FcChar32 (* FcHashFunc) (const FcChar8 *data); +typedef int (* FcCompareFunc) (const FcChar8 *v1, const FcChar8 *v2); typedef FcBool (* FcCopyFunc) (const void *src, void **dest); -- cgit v1.2.1