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.
This commit is contained in:
Tom Anderson 2023-02-10 23:53:15 +00:00 committed by Thomas Anderson
parent 2ef790a0db
commit 06929a556f
1 changed files with 2 additions and 2 deletions

View File

@ -408,8 +408,8 @@ typedef struct _FcStrBuf {
typedef struct _FcHashTable FcHashTable; typedef struct _FcHashTable FcHashTable;
typedef FcChar32 (* FcHashFunc) (const void *data); typedef FcChar32 (* FcHashFunc) (const FcChar8 *data);
typedef int (* FcCompareFunc) (const void *v1, const void *v2); typedef int (* FcCompareFunc) (const FcChar8 *v1, const FcChar8 *v2);
typedef FcBool (* FcCopyFunc) (const void *src, void **dest); typedef FcBool (* FcCopyFunc) (const void *src, void **dest);