summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Anderson <thomasanderson@chromium.org>2023-02-10 23:53:15 +0000
committerThomas Anderson <thomasanderson@google.com>2023-02-13 17:02:53 +0000
commit06929a556fdc39c8fe12965b69070c8df520a33e (patch)
tree2885a1b19d0605742c8e8af8aca804f1aa46472c
parent2ef790a0dbbab24235d1b8c0325ab4414de5f0a9 (diff)
downloadfontconfig-06929a556fdc39c8fe12965b69070c8df520a33e.tar.gz
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.
-rw-r--r--src/fcint.h4
1 files 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);