diff options
Diffstat (limited to 'external/fontconfig')
-rw-r--r-- | external/fontconfig/ExternalPackage_fontconfig.mk | 18 | ||||
-rw-r--r-- | external/fontconfig/ExternalPackage_fontconfig_data.mk | 61 | ||||
-rw-r--r-- | external/fontconfig/ExternalProject_fontconfig.mk | 65 | ||||
-rw-r--r-- | external/fontconfig/Makefile | 7 | ||||
-rw-r--r-- | external/fontconfig/Module_fontconfig.mk | 19 | ||||
-rw-r--r-- | external/fontconfig/README | 6 | ||||
-rw-r--r-- | external/fontconfig/UnpackedTarball_fontconfig.mk | 22 | ||||
-rw-r--r-- | external/fontconfig/fontconfig-2.12.1.patch.1 | 135 | ||||
-rw-r--r-- | external/fontconfig/libfontconfig-bundled-soname.patch.0 | 11 | ||||
-rw-r--r-- | external/fontconfig/ubsan.patch | 22 |
10 files changed, 366 insertions, 0 deletions
diff --git a/external/fontconfig/ExternalPackage_fontconfig.mk b/external/fontconfig/ExternalPackage_fontconfig.mk new file mode 100644 index 0000000000..b09931f5e8 --- /dev/null +++ b/external/fontconfig/ExternalPackage_fontconfig.mk @@ -0,0 +1,18 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalPackage_ExternalPackage,fontconfig,fontconfig)) + +$(eval $(call gb_ExternalPackage_use_external_project,fontconfig,fontconfig)) + +ifeq ($(DISABLE_DYNLOADING),) +$(eval $(call gb_ExternalPackage_add_file,fontconfig,$(LIBO_LIB_FOLDER)/libfontconfig-lo.so.1.12.0,src/.libs/libfontconfig-lo.so.1.12.0)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/fontconfig/ExternalPackage_fontconfig_data.mk b/external/fontconfig/ExternalPackage_fontconfig_data.mk new file mode 100644 index 0000000000..cc72312da4 --- /dev/null +++ b/external/fontconfig/ExternalPackage_fontconfig_data.mk @@ -0,0 +1,61 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalPackage_ExternalPackage,fontconfig_data,fontconfig)) + +$(eval $(call gb_ExternalPackage_use_external_project,fontconfig_data,fontconfig)) + +$(eval $(call gb_ExternalPackage_add_files,fontconfig_data,$(LIBO_SHARE_FOLDER)/fontconfig,\ + fonts.conf \ +)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,fontconfig_data,$(LIBO_SHARE_FOLDER)/fontconfig/conf.d,\ + conf.d/05-reset-dirs-sample.conf \ + conf.d/09-autohint-if-no-hinting.conf \ + conf.d/10-autohint.conf \ + conf.d/10-hinting-full.conf \ + conf.d/10-hinting-medium.conf \ + conf.d/10-hinting-none.conf \ + conf.d/10-hinting-slight.conf \ + conf.d/10-no-antialias.conf \ + conf.d/10-scale-bitmap-fonts.conf \ + conf.d/10-sub-pixel-bgr.conf \ + conf.d/10-sub-pixel-none.conf \ + conf.d/10-sub-pixel-rgb.conf \ + conf.d/10-sub-pixel-vbgr.conf \ + conf.d/10-sub-pixel-vrgb.conf \ + conf.d/10-unhinted.conf \ + conf.d/10-yes-antialias.conf \ + conf.d/11-lcdfilter-default.conf \ + conf.d/11-lcdfilter-legacy.conf \ + conf.d/11-lcdfilter-light.conf \ + conf.d/20-unhint-small-vera.conf \ + conf.d/25-unhint-nonlatin.conf \ + conf.d/30-metric-aliases.conf \ + conf.d/35-lang-normalize.conf \ + conf.d/40-nonlatin.conf \ + conf.d/45-generic.conf \ + conf.d/45-latin.conf \ + conf.d/48-spacing.conf \ + conf.d/49-sansserif.conf \ + conf.d/50-user.conf \ + conf.d/51-local.conf \ + conf.d/60-generic.conf \ + conf.d/60-latin.conf \ + conf.d/65-fonts-persian.conf \ + conf.d/65-khmer.conf \ + conf.d/65-nonlatin.conf \ + conf.d/69-unifont.conf \ + conf.d/70-no-bitmaps.conf \ + conf.d/70-yes-bitmaps.conf \ + conf.d/80-delicious.conf \ + conf.d/90-synthetic.conf \ +)) + +# vim: set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/external/fontconfig/ExternalProject_fontconfig.mk b/external/fontconfig/ExternalProject_fontconfig.mk new file mode 100644 index 0000000000..ee0301b251 --- /dev/null +++ b/external/fontconfig/ExternalProject_fontconfig.mk @@ -0,0 +1,65 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalProject_ExternalProject,fontconfig)) + +$(eval $(call gb_ExternalProject_use_externals,fontconfig,\ + $(if $(filter EMSCRIPTEN,$(OS)),libxml2,expat) \ + freetype \ +)) + +$(eval $(call gb_ExternalProject_register_targets,fontconfig,\ + build \ +)) + +# Can't have this inside the $(call gb_ExternalProject_run as it contains commas +fontconfig_add_fonts=/usr/share/X11/fonts/Type1,/usr/share/X11/fonts/TTF,/usr/local/share/fonts + +$(call gb_ExternalProject_get_state_target,fontconfig,build) : + $(call gb_Trace_StartRange,fontconfig,EXTERNAL) + $(call gb_ExternalProject_run,build,\ + $(if $(filter -fsanitize=undefined,$(CC)),CC='$(CC) -fno-sanitize=function') \ + CFLAGS="$(CFLAGS) \ + $(call gb_ExternalProject_get_build_flags,fontconfig) \ + $(gb_VISIBILITY_FLAGS) \ + $(if $(filter EMSCRIPTEN,$(OS)),-pthread)" \ + $(if $(filter ANDROID,$(OS)),LIBS="-lm") \ + $(if $(filter EMSCRIPTEN,$(OS)),LIBXML2_CFLAGS="$(LIBXML_CFLAGS)" LIBXML2_LIBS="$(LIBXML_LIBS)") \ + $(gb_RUN_CONFIGURE) ./configure \ + --disable-silent-rules \ + --with-pic \ + $(if $(filter ANDROID,$(OS)),--with-arch=arm) \ + --with-expat-includes=$(call gb_UnpackedTarball_get_dir,expat)/lib \ + --with-expat-lib=$(gb_StaticLibrary_WORKDIR) \ + $(gb_CONFIGURE_PLATFORMS) \ + $(if $(filter ANDROID,$(OS)), \ + --disable-shared \ + ) \ + $(if $(filter EMSCRIPTEN,$(OS)), \ + --disable-shared \ + --with-baseconfigdir=/instdir/share/fontconfig \ + --with-cache-dir=/instdir/share/fontconfig/cache \ + --with-add-fonts=/instdir/share/fonts \ + --enable-libxml2 \ + ac_cv_func_fstatfs=no ac_cv_func_fstatvfs=no \ + ) \ + $(if $(filter FUZZERS,$(BUILD_TYPE)), \ + --disable-shared, \ + $(if $(filter LINUX,$(OS)), \ + --disable-static \ + --prefix=/ \ + --with-add-fonts=$(fontconfig_add_fonts) \ + --with-cache-dir=/usr/lib/fontconfig/cache \ + ) \ + ) \ + && $(MAKE) -C src && $(MAKE) fonts.conf \ + ) + $(call gb_Trace_EndRange,fontconfig,EXTERNAL) + +# vim: set noet sw=4 ts=4: diff --git a/external/fontconfig/Makefile b/external/fontconfig/Makefile new file mode 100644 index 0000000000..e4968cf85f --- /dev/null +++ b/external/fontconfig/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/external/fontconfig/Module_fontconfig.mk b/external/fontconfig/Module_fontconfig.mk new file mode 100644 index 0000000000..61f201d415 --- /dev/null +++ b/external/fontconfig/Module_fontconfig.mk @@ -0,0 +1,19 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Module_Module,fontconfig)) + +$(eval $(call gb_Module_add_targets,fontconfig,\ + ExternalProject_fontconfig \ + $(if $(filter EMSCRIPTEN,$(OS)),ExternalPackage_fontconfig_data) \ + $(if $(filter LINUX,$(OS)),ExternalPackage_fontconfig) \ + UnpackedTarball_fontconfig \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/fontconfig/README b/external/fontconfig/README new file mode 100644 index 0000000000..318d99594d --- /dev/null +++ b/external/fontconfig/README @@ -0,0 +1,6 @@ +This "bundled" fontconfig is usually built only in an Android build or a fuzzing build + +Fontconfig is a font configuration and customization library. It is designed to locate fonts +within the system and select them according to requirements specified by applications. + +From [ https://www.freedesktop.org/wiki/Software/fontconfig/ ] diff --git a/external/fontconfig/UnpackedTarball_fontconfig.mk b/external/fontconfig/UnpackedTarball_fontconfig.mk new file mode 100644 index 0000000000..ceb87ea062 --- /dev/null +++ b/external/fontconfig/UnpackedTarball_fontconfig.mk @@ -0,0 +1,22 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_UnpackedTarball_UnpackedTarball,fontconfig)) + +$(eval $(call gb_UnpackedTarball_set_tarball,fontconfig,$(FONTCONFIG_TARBALL),,fontconfig)) + +$(eval $(call gb_UnpackedTarball_set_patchlevel,fontconfig,0)) + +$(eval $(call gb_UnpackedTarball_add_patches,fontconfig,\ + external/fontconfig/fontconfig-2.12.1.patch.1 \ + external/fontconfig/ubsan.patch \ + external/fontconfig/libfontconfig-bundled-soname.patch.0 \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/fontconfig/fontconfig-2.12.1.patch.1 b/external/fontconfig/fontconfig-2.12.1.patch.1 new file mode 100644 index 0000000000..b6f54361bb --- /dev/null +++ b/external/fontconfig/fontconfig-2.12.1.patch.1 @@ -0,0 +1,135 @@ +diff -up fontconfig/configure.dt fontconfig/configure +--- fontconfig/configure.dt 2023-01-27 17:22:13.000000000 +0900 ++++ fontconfig/configure 2023-02-21 20:04:01.347467874 +0900 +@@ -11534,7 +11534,7 @@ _LT_EOF + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support +- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' ++ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $lib' + archive_expsym_cmds='' + ;; + m68k) +@@ -11550,7 +11550,7 @@ _LT_EOF + allow_undefined_flag=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME +- archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' ++ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags -o $lib' + else + ld_shlibs=no + fi +@@ -11584,7 +11584,7 @@ _LT_EOF + ;; + + haiku*) +- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' ++ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $lib' + link_all_deplibs=yes + ;; + +@@ -11680,13 +11680,13 @@ _LT_EOF + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac +- archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' ++ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags -o $lib' + + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ +- $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' ++ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in +@@ -11716,8 +11716,8 @@ _LT_EOF + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else +- archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags -o $lib' ++ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + +@@ -11735,8 +11735,8 @@ _LT_EOF + + _LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then +- archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags -o $lib' ++ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi +@@ -11764,8 +11764,8 @@ _LT_EOF + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' +- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $lib' ++ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi +@@ -11782,8 +11782,8 @@ _LT_EOF + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then +- archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags -o $lib' ++ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi +@@ -12086,7 +12086,7 @@ fi + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support +- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' ++ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $lib' + archive_expsym_cmds='' + ;; + m68k) +@@ -12356,7 +12356,7 @@ fi + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then +- archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ++ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. +@@ -12386,7 +12386,7 @@ fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 + printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } + if test yes = "$lt_cv_irix_exported_symbol"; then +- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' ++ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' +@@ -12482,7 +12482,7 @@ printf "%s\n" "$lt_cv_irix_exported_symb + osf3*) + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' +- archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ++ archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' +@@ -12495,7 +12495,7 @@ printf "%s\n" "$lt_cv_irix_exported_symb + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' +- archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ++ archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' diff --git a/external/fontconfig/libfontconfig-bundled-soname.patch.0 b/external/fontconfig/libfontconfig-bundled-soname.patch.0 new file mode 100644 index 0000000000..14da823315 --- /dev/null +++ b/external/fontconfig/libfontconfig-bundled-soname.patch.0 @@ -0,0 +1,11 @@ +# -*- Mode: Diff -*- +--- src/Makefile.in ++++ src/Makefile.in +@@ -529,6 +529,6 @@ + lib_LTLIBRARIES = libfontconfig.la + libfontconfig_la_LDFLAGS = \ +- -version-info @LIBT_VERSION_INFO@ -no-undefined $(export_symbols) ++ -version-info @LIBT_VERSION_INFO@ -no-undefined $(export_symbols) -release lo -Wl,-soname -Wl,libfontconfig-lo.so.1.12.0 + + libfontconfig_la_LIBADD = $(ICONV_LIBS) $(FREETYPE_LIBS) $(LIBXML2_LIBS) $(EXPAT_LIBS) $(LTLIBINTL) + libfontconfig_la_DEPENDENCIES = $(fontconfig_def_dependency) 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) |