From f263e3fe2e11810a517925d580640a21402ae36b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 21 Nov 2022 17:04:55 -0700 Subject: [PATCH] [cff] Manually copy short strings instead of memcpy() --- src/hb-subset-cff-common.hh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hb-subset-cff-common.hh b/src/hb-subset-cff-common.hh index c7e858e0b..2b7a2dab3 100644 --- a/src/hb-subset-cff-common.hh +++ b/src/hb-subset-cff-common.hh @@ -119,7 +119,11 @@ struct str_encoder_t set_error (); return; } - memcpy (buff.arrayZ + offset, &str[0], str.length); + /* Since our strings are one or two bytes typically, + * this is faster than memcpy. */ + for (unsigned i = 0; i < str.length; i++) + buff.arrayZ[i + offset] = str.arrayZ[i]; + // memcpy (buff.arrayZ + offset, &str[0], str.length); } bool is_error () const { return error; }