summaryrefslogtreecommitdiffstats
path: root/external/fontconfig/ubsan.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /external/fontconfig/ubsan.patch
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/fontconfig/ubsan.patch')
-rw-r--r--external/fontconfig/ubsan.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/external/fontconfig/ubsan.patch b/external/fontconfig/ubsan.patch
new file mode 100644
index 0000000000..91586b0934
--- /dev/null
+++ b/external/fontconfig/ubsan.patch
@@ -0,0 +1,22 @@
+--- src/fcdir.c
++++ src/fcdir.c
+@@ -265,7 +265,7 @@
+ /*
+ * Sort files to make things prettier
+ */
+- qsort(files->strs, files->num, sizeof(FcChar8 *), cmpstringp);
++ if (files->num != 0) qsort(files->strs, files->num, sizeof(FcChar8 *), cmpstringp);
+
+ /*
+ * Scan file files to build font patterns
+--- src/fcserialize.c
++++ src/fcserialize.c
+@@ -163,7 +163,7 @@
+ size_t old_used = serialize->buckets_used;
+ size_t old_count = serialize->buckets_count;
+ FcSerializeBucket *old_buckets = serialize->buckets;
+- FcSerializeBucket *old_buckets_end = old_buckets + old_count;
++ FcSerializeBucket *old_buckets_end = old_count == 0 ? old_buckets : old_buckets + old_count;
+
+ FcSerializeBucket *new_buckets = malloc (new_count * sizeof (*old_buckets));
+ if (!new_buckets)